I am confused in String.It's given in the book that string is object in java and it is created by using the class "String".And if you write "Object ob" then only the reference of that class is created and it points to "Null",an object is created by using "new" operator,"Object ob=new Object()".
Since the objects are created by using "new" operator where the memory is allocated dynamically during run-time, how in case of string this given statement is possible "String ob="Hello",without allocating memory for it.
String is special - the Java language has special syntax for creating strings. Suppose there were no string literals in Java, then it would be incredibly cumbersome to initialize a String object with separate characters. You'd have to do something like this: