As we know abstract classes can never be instantiated .then what is the use of building the constructer by the compiler during copilation of abstract class
for example if i declare my abstract class
when i decompile my class file..
Every class needs at least one constructor, for constructor chaining. If a class (abstract or not) does not have a constructor sub classes cannot call it. Therefore, you would not be able to sub class the class at all. In fact, this is exactly what happens if you only provide a private constructor.
Surprisingly, it is. Apparently the compiler puts all initializations that occur when declaring in source code, into all constructors. For instance:
As you can see, the initialization of x to 10 is moved to both constructors.