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 prefix of a string?
What is the program compilation process?
What is sortedset in java?
How do you use substring in java?
Can we declare the static variables and methods in an abstract class?
Can I extend singleton class in java?
Which variables are stored in stack?
What is a java string?
Can we have more than one package statement in the source file?
What is set and get methods in java?
Can we have 2 main methods in java class?
How to display arraylist values in java?
What are annotations in java?
What does null mean in java?
Write the algorithm to check the number non-leaf nodes in a tree.