Java toString() method.

Java 8Object Oriented ProgrammingProgramming

The toString() method of the String class returns itself to a string.

Example

Live Demo

import java.io.*;
public class Test {
   public static void main(String args[]) {
      String Str = new String("Welcome to Tutorialspoint.com");
      System.out.print("Return Value :");
      System.out.println(Str.toString());
   }
}

Output

Return Value :Welcome to Tutorialspoint.com
raja
Published on 12-Feb-2018 09:53:00
Advertisements