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 is meant by anonymous class?

790


Why we cannot override static method?

754


who can i handle multiple client in RMI

1651


What is the full meaning of java?

763


Can we declare an interface as final?

769


What is object-oriented paradigm?

815


What is a variable in java?

732


Can you override a final method?

784


How do you empty a list in java?

750


What are the different approaches to implement a function to generate a random number?

788


What's the base class of all exception classes?

782


List some features of the abstract class.

779


What are some examples of variable costs?

701


How can you read content from file in java?

795


What are different types of inner classes ?

764