Abstract class Non static variables in Java  | Core Java Training

This Core Java Training “Abstract class Non static variables in Java” is providing information about how to initialize instance variables of abstract class using super() method in the process of child object creation.


 

Object creation of Abstract class:

  • We cannot instantiate ‘abstract class’ directly.
  • Abstract class need an extension(child class).
  • In the process of Child object creation, Parent class object will be created implicitly.
  • By defining constructor, we can check Abstract class object creation through its Child.

 

Can we place non-static variables inside abstract class ?

  • Yes allowed.
  • Non static variables are called object variables.
  • Non static variables get memory allocation inside object.
  • We can’t create object for abstract class directly. It is possible through Child class.
  • Hence we provide initial values using super() method from Child class.

 

Share this