1).what is the difference between below examples

String s="vijay";

String s=new String("vijay");

Answer Posted / karun_cts

the two instances are created with the same name but one is
storing in constant pool and another one is saved in the
non constant pool.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of java?

545


When do we use synchronized blocks and advantages of using synchronized blocks?

650


what is deadlock? : Java thread

517


what is the difference between a threads start() and run() methods? : Java thread

511


What are the data types supported by java? What is autoboxing and unboxing?

534






What are the advantages of passing this into a method instead of the current class object itself?

1153


Does java trim remove newline?

524


What is thread safe java?

478


Does substring create a new object?

519


What is the meaning of nullable?

566


Which is easier netbeans or eclipse?

599


What are different types of expressions?

543


Difference between string, string builder, and string buffer?

514


Can variables be used in java without initialization?

541


What is OOP's Terms with explanation?

592