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


Please Help Members By Posting Answers For Below Questions

What is the synonym of string?

531


What is string in java? String is a data type?

573


How many bytes is a string?

556


What are different types of references?

526


What is method in java ?

620






Is empty string in java?

534


Why does java have different data types for integers and floating-point values?

529


What is string [] java?

524


What is natural ordering in java?

519


What is the most important feature of java? What is an interface?

510


Can we execute a program without main() method?

526


How do you call a reference in java?

515


What do you mean by buffering?

548


Why do we need autoboxing in java?

514


What are the four pillars of java?

608