how can u create the object with out new operator

Answers were Sorted based on User's Feedback



how can u create the object with out new operator..

Answer / 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

how can u create the object with out new operator..

Answer / bindhu

As my opinion, we can create object of String using 2 ways:
String s=new String("java");
String s="java";

in Other way ,we can clone an object,that will create a
new copy of an object.

or using Class.forName();( Not Sure....)

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More Core Java Interview Questions

what is jms? features of jms

2 Answers   CTS,


What are the four integer types supported by java?

0 Answers  


What is a parameter in java?

0 Answers  


Can we clone singleton class in java?

0 Answers  


What is an infinite loop? How infinite loop is declared?

0 Answers  






How does Vector implement synchronization?

4 Answers   Ness Technologies,


What is string literal in java?

0 Answers  


What methods are called, When we navigate from one applet to another applet?

1 Answers  


How to stop a thread in java? Explain about sleep () method in a thread?

0 Answers  


Is arraylist ordered?

0 Answers  


If a class is declared without any access modifiers, where can the class be accessed?

0 Answers  


________ exception must be either caught or specified in throws class of the method.

1 Answers  


Categories