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
What is the difference between a switch statement and an if statement?
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?
Why collection is called framework in java?
What does it mean that a method or field is “static”?
Is integer passed by reference in java?
Why const and goto are reserved keyword in java?
What is final keyword in java? Give an example.
In java, how many ways you can take input from the console?
Can we have multiple classes in single file ?
what is the difference between ArrayList and Vector
19 Answers KPIT, Sasken, Satyam, Span Infotech, Wipro,
Can private class be inherited in java?
What is one third plus one third as a fraction?