Construction Function In Java(II)

It is very important to know about construction function. Through the basic learning about programming no matter Java language or PHP language, now the higher level of program about construction function has already been introduced. For some newbie, we may state this topic and share the knowledge about it. Today, according to popular Java, let us well know about construction function related its uses and features in Java.tin plate suppliers

Basic program’s word to know

Actually as our common saying, the function exactly is method, meanwhile, construction function equals to constructor method. Certainly, the most of time as insiders of programming industry may call it constructor as shortcut.

Call problem of Java constructor – Not Inheritability

  • The subclass only call the default constructor of the parent class, which is the invisible parameter constructor function. If the parent class does not have a default constructor, the subclass cannot call the default constructor from the parent class.
  • The subclass can not be the default constructor of the subclass by calling the default constructor from he parent class.
  • When creating an object, the default constructor of the parent class is called to initialize the object, and then the constructor defined by the subclass itself will be called.
  • If the subclass wants to call the non-default constructor of the parent class, it must be implemented using ‘super’ keyword.
  • The subclass must call the constructor of the parent class. The default constructor of the parent class can be automatically called by the system. If the parent class does not have a default constructor, the subclass constructor must invoke the constructor of the parent class through ‘super’.

Leave Comment

Your email address will not be published. Required fields are marked *