Home > Back-end >  The abstract, the static, final cannot be used to modify a constructor
The abstract, the static, final cannot be used to modify a constructor

Time:04-09

Abstract: abstract method only method statement, there is no way that the implementation of the implementation of a subclass is complete; But a constructor cannot be subclass inherits, if the constructor is the abstract modifiers, the subclass cannot complete the realization of the construction method of the content, then the abstract of this method will have no effect, the constructor of the abstract will never be realized, so it can't declare to the abstract


Static: static has nothing to do with the object, but a constructor is used to create objects, contradict each other; At the same time the static modified method can directly by the name of the class. A static method name (argument); Calls, but does not allow manual constructor calls, the constructor is always associated with an object and is called, so there is no meaning to declare it as the static

Final, final method is constraint subclasses can not cover, but do not allow the subclass constructor itself inherit, no cover, (constructor is not through the cover, so it is not necessary to use the final modification) constructor is not through inheritance, so there's no need to declare it as final

CodePudding user response:

The building Lord said right,
  • Related