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 format specifiers in java?

0 Answers  


when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)dopost() d)service

4 Answers   Accenture,


Does java runtime require a license?

0 Answers  


Explain restrictions for using anonymous inner classes?

0 Answers  


What is purpose of find feature?

0 Answers  






How does JAVA ClassLoader work?

1 Answers   IBM,


Can we use both this () and super () in a constructor?

0 Answers  


Can a static method be overridden in java?

0 Answers  


explain about casting of objects?

5 Answers  


What is local class in java?

0 Answers  


How to create packages in java?

0 Answers  


How many types of exception can occur in a java program?

0 Answers  


Categories