What is difference between abstract class & final class
Answer Posted / farhad
A final class CANNOT be extended or subclassed however it can be instantiated:
final class A{
}
class B{
A a = new A(); //<<< instantiating final class A
We cannot say:
class B extends A //!!! that's a NO NO.
On the other hand abstract class can be subclassed but CANNOT be instantiated.
abstract class A{
}
class B extends A{
}
| Is This Answer Correct ? | 9 Yes | 6 No |
Post New Answer View All Answers
what happens when a thread cannot acquire a lock on an object? : Java thread
What do you mean by stream pipelining in java 8?
What is arrays fill in java?
How long will it take to learn java?
What are sets in java?
Can a class with private constructor be extended?
What is string subsequence method?
What is return used for in java?
How do you reverse sort a list in java?
What is java literals?
What do you mean by collectors in java 8?
What does g mean in regex?
Assume a thread has lock on it, calling sleep() method on that thread will release the lock?
Can we create a class inside a class in java?
Which programming language is best in future?