How can u create the Object of class Without using "New"
opertor?
Answer Posted / mohan reddy
In 3 ways we can able to create object without using "new"
operator.
1)Using a Static Factory Method
ABC.getInstance();
2)Using newInstance() method...
class A=(A)Class.forName("A").newInstance();
3)Using clone() method.
| Is This Answer Correct ? | 38 Yes | 7 No |
Post New Answer View All Answers
Why are constructors used?
What is the difference between class & structure?
Which is dependent variable?
how are methods defined?
What does jenkins do?
How to provide security in java
What is the use of optional ?
what is meant by abstract class?
Explain method overloading?
What are the different ways of implementing thread? Which one is more advantageous?
what is predefined function in java?
what is the use of bean managed and container managed with example?
What is difference between static and final?
what do you mean by classloader?
What is the relationship between clipping and repainting under awt?