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 difference between ArrayList and Vector? which one is better in Java

702


describe synchronization in respect to multithreading? : Java thread

605


What is java in layman terms?

622


What is the program compilation process?

675


Why is the main method declared static?

678






What is an example of character?

663


Do you need to import math in java?

654


What is the difference between equals() and == in java?

600


What is ctrl m character?

616


What is the disadvantage of synchronization?

660


Name few java 8 annotations ?

687


What are adapter classes?

684


Is it safe to install java on my computer?

642


How to handle a web browser resize operation?

627


If a class is declared without any access modifiers, where can the class be accessed?

682