how you will prevent inheritance is there any other way
other than inheritance?
Answers were Sorted based on User's Feedback
Answer / raju
One way to prevent inhertance is final class
2) Using private Constructor in a class we can prevent
inhertance[Single ton class ]
Alternate of in hertance are
delegation,composition, aggrigration etc..
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / marx
If you declare the class as a final,we cant inherit the
class.
| Is This Answer Correct ? | 5 Yes | 3 No |
What environment variables do I need to set on my machine in order to be able to run java programs?
How many wrapper classes are there in java?
Java is based on pass by reference or pass by value ..
Why do we need data serialization?
Can we sort arraylist in java?
Can a lock be acquired on a class in java programming?
What is the syntax and characteristics of a lambda expression?
What is private static class in java?
Given: 11. public static void main(String[] args) { 12. Integer i = uew Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println(”three”); break; 15. default: System.out.println(”other”); break; 16. } 17. } ‘What is the result? 1 three 2 other 3 An exception is thrown at runtime. 4 Compilation fails because of an error on line 12.
What is the purpose of tostring() method in java?
What class of exceptions are generated by the java run-time system?
What is difference between hash mapping and hash table?