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

Why there are some null interface in java? What does it mean?

640


Can we use a default constructor of a class even if an explicit constructor is defined?

644


What methodology can be utilized to link to a database?

502


Name few java 8 annotations ?

558


What is a variable simple definition?

572






Can you inherit from an abstract class java?

523


What is an object's lock and which object's have locks in java programming?

561


explain the difference between jdk and jvm?

555


What is * argv?

696


Is java se open source?

560


Why lambda expression is used in java?

565


What are register variables what are the advantages?

443


What happens when main () method is declared as private?

646


Does the order of public and static declaration matter in main method?

608


What does || mean in code?

536