📜  构造函数与块 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:37.758000             🧑  作者: Mango

代码示例1
constructor: instance of the class.
            private constructor (Driver class)  ==> singleton class
            constructor can only be called within another constructor
               constructor will be executed when the object is created
            can be overloaded cannot be overridden
        
        static block: belongs to the class
                 executed as soon as the class is loaded
                 only gets executed once.
                
        instance block:  belongs to the object
                        gets executed when the object is created
                        executed before constructor