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
why an outer class cannot be declared as private?
What are bind parameters?
Can array grow dynamically in java?
What is difference between calling start() and run() method of thread?
Explain the difference between an Interface and an Abstract class?
How many types of methods are there?
Can a class extend more than one class?
What is main in java?
What is class and object in java?
How is string stored in java?
Can bool be null?
Why spring singleton is not thread safe?
What is string immutability?
How to overcome the exception object reference not set to an instance of object?
Difference between object instantiation and construction ?