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 are the difference between string, string builder, and string buffer in java?
What will happen if static modifier is removed from the signature of the main method?
Explain the advantages of packages in java?
Can singleton class be cloned?
What are the types of sockets in java?
What are alternatives to java serialization?
Why char array is favored over string for the storage of passwords?
Is a boolean 1 bit?
How many types of threads are there in java?
What is lazy initialization in java?
What is wrapper class html?
What is array list in java?
What is JFC?
You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain
Do I need java on my pc?