String can be converted into String Object with the help of toString() method in java. toString() method returns a value in String Object.
Sample code of String toString() in java.
public class StringToStringObjectExample {
public static void main(String[] args) {
String string = "Java String Object";
Object strObject = string.toString();
System.out.println("Output :"+strObject);
}
}
0 comments:
Post a Comment