How to create an instance of a class without using "new"
operator? Plz help me out properly.Thank u.
Answer Posted / b s vidyasagar reddy
three types
1.using factory methods
NumberFormat obj = NumberFormat.getNumberInstance();
2. using newInstance() method
class c = class.forName("Employee");
Employee obj = c.newInstance();
3. using coloning:
coloning is a way to create Bitwise exactcopy of an
existing object
Employee e2=e1.clone();
Is This Answer Correct ? | 32 Yes | 4 No |
Post New Answer View All Answers
What is keyset in java?
Why is String immutable?
What are variable names?
How java enabled high performance?
Is 0 an even number?
What are methods in java?
What are namespaces in java?
What are the 5 types of research methods?
What is a static class in java?
What is the difference between sleep and wait in java?
Explain the importance of finalize() method.
When is update method called?
What are the string methods in java?
What is a lambda expression ? What's its use ?
What is meant by local variable and instance variable?