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 mutability?which one is mutable String or StringBuffer?and why?give examples of each which shows the mutability of each String or StringBuffer

4 Answers   IBM, Zenon,


What are the uses of synchronized keyword?

0 Answers  


how we can write the string concatenation program in java.

3 Answers  


What is an object’s lock and which object’s have locks?

0 Answers  


Difference between JDK, JRE, JVM

16 Answers   Deloitte, HCL, Mind Tree, Oracle, Reliance, TCS, ThinkBox,






Is this valid in java ? Can we instantiate interface in java?

0 Answers  


Can we convert integer to string in java?

0 Answers  


Can we start a thread twice in java?

0 Answers  


What are the types of casting?

0 Answers  


Explain the difference between the Boolean & operator and the && operator?

1 Answers  


What type of value does sizeof return?

0 Answers  


What is the difference between panel and frame ?

7 Answers   HCL, IBM, Raim Techno Solutions,


Categories