How many objects are created when we create String class
object using new operator?
Answer Posted / mahesh
yes two objects will be created when you use new operator
for a String. The reason for this is at first it creates an
object in HEAP and then verifies in the String Constant
Pooling if it is not available then creates the new one in
pool. so totally two object will be created.
| Is This Answer Correct ? | 22 Yes | 5 No |
Post New Answer View All Answers
What is the static import?
Can an interface extend a class?
What is difference between calling start() and run() method of thread?
Can you call a method in a method?
What is fail fast in java?
How many times finalize method will be invoked? Who invokes finalize() method in java?
Is age a discrete variable?
What is meant by inheritance and what are its advantages?
how can i use a nonsynchronized hashtable?
What is a java lambda expression?
What is the generic function?
What is tree in java?
How does list work in java?
Can a variable be local and static at the same time?
What are parameters in a method?