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 meant by oops concept in java?

508


How to display all the prime numbers between 1 and n (n is the number, get the input from user)

517


Is set thread safe java?

504


What are latest features introduced with java 8?

595


Can we have more than one package statement in source file ?

592






Similarity and difference between static block and static method ?

541


What is a byte array?

593


Name some OOPS Concepts in Java?

644


What is getkey () in java?

581


Is assembly language a low level language?

504


What is the difference between hashmap and hashtable in java?

560


Can bool be null?

528


v-model life cycle

1624


What is vector?

591


What is the difference between Grid and Gridbaglayout?

587