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 a java predicate?

1 Answers  


What does math floor () do?

1 Answers  


Is 0 a real number?

1 Answers  


What is difference between module and function?

1 Answers  


What are the various access specifiers in java?

1 Answers  


What is instanceof keyword?

1 Answers  


What is the difference between C++ & Java?

78 Answers   College School Exams Tests, HAL, SUN, Syntel, TCS, Wipro,


How to perform selection sort in java?

1 Answers  


What is difference between abstract class & final class

7 Answers  


What are triggers in DB? Explain their types. How do they work?

1 Answers   Amdocs,


Why pointers are not used in java?

1 Answers  


Explain the significance of listiterator.

1 Answers  


Categories