1).what is the difference between below examples

String s="vijay";

String s=new String("vijay");

Answer Posted / karun

In first statement String s = "vijay"

Means it will create a single instance and single reference
variable

but in second statement

String s = new String("vijay");

Means it will create a two instances and single reference
variable

Is This Answer Correct ?    4 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between a process and a program?

796


What is the difference between jdk and jre?

807


How many types of memory areas are allocated by jvm?

751


How do you find the independent variable?

726


What is singleton class in java and how can we make a class singleton?

804


What is meant by class loader? How many types are there?

898


What is the output of the below java program?

797


What does null mean in java?

819


What checkbox method allows you to tell if a checkbox is checked?

753


Define jit compiler?

823


If a class is declared without any access modifiers, where may the class be accessed in java programming?

876


What is the definition of tree ?

742


How will you initialize an Applet?

820


What is meant by final class?

759


Does .length start 0 java?

738