super-constructor if there is no super class?

后端 未结 5 957
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 09:42

I found a class like this:

public class Computer implements Serializable {

        private static final long serialVersionUID = 1L;    

        //...
              


        
5条回答
  •  [愿得一人]
    2020-12-11 10:31

    In Java, Object class is at the top of the Class hierarchy. Implicitly, All the Classes are implicitly of Object type. Invocation of super() method is not needed explicitly in code. But, this will be added by the compiler during conversion of Class into bytecode. so, the first line in any constructor would be invocation of super() implicitly by default. Construction of an object includes all the invocation of default constructors of Super classes. But, you can also call a customized argument constructor of the super class in your class constructor.

提交回复
热议问题