I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More Core Java Interview Questions

What is the difference between a switch statement and an if statement?

0 Answers  


interface X{ void m1(); void m2(); } class Child2 extends Object implements X { public void m1(){ System.out.println("Child2 M1"); } public void m2(){ System.out.println("Child2 M2"); } } public class ParentChildInfterfaceDemo { public static void main(String[] args){ X x = new Child2(); X x1 = new Child2(); x.m1(); x.m2(); x.equals(x1); } } Will the above code work? If yes? Can you please explain why the code x.equals(x1) will work as the equals method is called on interface reference vaiable?

2 Answers  


Why collection is called framework in java?

0 Answers  


What does it mean that a method or field is “static”?

0 Answers  


Is integer passed by reference in java?

0 Answers  






Why const and goto are reserved keyword in java?

1 Answers  


What is final keyword in java? Give an example.

0 Answers  


In java, how many ways you can take input from the console?

0 Answers  


Can we have multiple classes in single file ?

0 Answers  


what is the difference between ArrayList and Vector

19 Answers   KPIT, Sasken, Satyam, Span Infotech, Wipro,


Can private class be inherited in java?

0 Answers  


What is one third plus one third as a fraction?

0 Answers  


Categories