Anything between "quotes" in your source code is a String object.
It would be really annoying if Java did not have native support for strings and you'd have to do difficult things just to have a string in your source code. It would become really tedious if you'd have to write something like this every time:
now a is an reference variable or object,if object hows that possible because new keyword is used whenever we create an object
Although String is a class, it has been given special language support to behave almost like a primitive. The String literal "Arnold" will be represented by an internal String object which reference is used every time "Arnold" appears.
Campbell Ritchie wrote: . . . and using the new keyword for Strings will cause unintended results, eg two identical Strings. This is quite unnecessary for 99.9% of applications.
yes correct. Becasue if you make string object like this String s1= "John", it creates string object in String pool and when you create String s2 ="John", JVM doesn't create new object, instead it gives the reference of the same object to s2. it means both s1 and s2 will point to the same string object in String pool.