hi i happened to answer the wrong question the answer to yours question is that when we write String a=new String("abc"); a new String object is created. And when we write String b="abc"; the jvm searches in string pool and if a String object containing abc is present then it returns the reference to that string and if not present it creates a new String object and adds it to the pool and returns a reference to that obect. Here is an example which will clear your doubt public static void main(String a[]) { String a=new String("abc"); String b="abc"; String c="abc"; System.out.print(a==b);//prints false System.out.print(a==c);//prints false System.out.print(c==b);//prints true System.out.print(a.equals(b));//prints true System.out.print(a.equals(c));//prints true System.out.print(c.equals(b));//prints true }
Well the question is different then the reply of Rohit Suman as
Originally posted by Rohit Suman: [Q]definately you can use static and native modifier are used to load any native files they may be required to run the program [/Q]
Earlier when I check this thread the Name of this thread was "static", but now it has been changed to "String".
No you answered the correct question There was a topic about "static" and "native". The bulletin board seems to be a little confused and mixing stuff up today - we are investigating the problem.