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 are the two main uses of volatile in Java?

0 Answers  


why interfaces are faster than abstract classes?

4 Answers  


How to pass arraylist to stored procedure in java?

0 Answers  


What is the latest java version?

0 Answers  


What is the difference between hashmap and hashtable in java?

0 Answers  


Explain the concept of proper inheritance?

0 Answers   Thomson Reuters, Virtusa,


Does java trim remove newline?

0 Answers  


Can we declare a constructor as final?

0 Answers  


what is the difference between the "protected and default" modifiers?

8 Answers  


What is split return?

0 Answers  


String Reverse in Java...!

5 Answers  


Can we use different return types for methods when overridden?

0 Answers  


Categories