1).what is the difference between below examples
String s="vijay";
String s=new String("vijay");
Answer Posted / navneet raushan
the first case does: if u write first case , one object and
one refernce will be created. object will be created in
string pool.
But when u write 2nd case , two object and one refernce
will be created , one in string pool and one in heap.
| Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
Can we force garbage collector to run ?
What is the return type of the main method?
What is java full form?
How are variables stored?
Is java code slower than native code?
Why strings in java are called as immutable?
What is a for loop in java?
Why hashset is used in java?
Write a program to print 15 random numbers using foreach of java 8?
What is a singleton class? Give a practical example of its usage.
What are the types of sockets in java?
Write a program to print count of empty strings in java 8?
What are nested classes in java?
What is the purpose of garbage collection in java?
What are the restrictions imposed by a Security Manager on Applets?.