Possible Duplicate:
How many java objects generated by this code? and why?
I am very confused in the following
String s1 = new String("Java");
String s2 = new String("Java");
How many objects are created here?
String s1 = new String("Java");
String s2 = new String("Ruby");
How many objects are created here?
String s1 = new String("Java");
String s2 = "Java";
How many objects are created here?
String s1 = "Java";
String s2 = "Java";
How many objects are created here?