Consider the code :
public class Strings {
public static void createStr()
{
String s1 = new String("one");
String s2 = "one";
System.out.println(s1);
System.out.println(s2);
}
public static void main(String args[])
{
createStr();
}
}
What's the difference between String s1 = new String("one");
and String s2 = "one";
?
No comments:
Post a Comment