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 java instanceof operator?
What is the length of a string?
What is java console application?
Why hashcode is used in java?
What is string [] args?
How are java objects passed to a method and what are native methods?
What is the difference between Java and C++?
What is void class in java?
Can we sort a map in java?
How to use string tokenizer class.
What is the do while loop syntax?
What is final class?
Can java arraylist hold different types?
What are kinds of processors?
What is the lifetime and scope of a variable?