how can u create the object with out new operator

Answer Posted / md. abid hossain

In 3 ways..
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 ?    11 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are parsing rules?

611


What exceptions occur during serialization?

716


How to make a class or a bean serializable?

621


Can I uninstall java?

646


What is the benefit of inner classes in java?

722






Why is the singleton pattern considered to be an anti pattern?

563


List the interfaces which extends collection interface?

613


What is append function?

655


Why char array is favored over string for the storage of passwords?

653


What do you understand by casting in java language?

692


I want to re-reach and use an object once it has been garbage collected. How it's possible?

659


How can you handle java exceptions?

613


Can you extend singleton class?

716


How to write custom exception in java?

695


What are the features of java?

624