Pavithra Hennayaka wrote:we don't create objects of String using new keyword but to create objects of other reference type new is used.so what is the difference between other reference types and String?
First, your statement is incorrect; you can create Strings using new, it's just not advisable in many cases.
And the basic answer to your question is: essentially, nothing. A String is a reference type; the only thing the language has done is to allow a few extra goodies such as literals and the overloaded '+' operator to make them easier to use. There's also the String pool, but String isn't the only class to have cached values.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
String is only special because otherwise you would have to do a lot of extra work. Consider the following example:
If String weren't special, you would have to write the following:
As you see that looks bad, and it takes too long to write. Therefore, the creators of Java (and several other languages as well; even C has string literals even though it doesn't have a string type) decided that String will be like any other object, but with a few syntactic extras like String literals and String concatenation with +. They also added the String pool to prevent a new object to be created for each String literal. As far as I know, those are the only differences.