Think in java 答案

    技术2022-05-11  110

    阅前声明: http://blog.csdn.net/heimaoxiaozi/archive/2007/01/19/1487884.aspx 

    /****************** Exercise 1 ******************* Create a class with a default constructor (one* that takes no arguments) that prints a* message. Create an object of this class.***********************************************/public class E01_DefaultConstructor {  E01_DefaultConstructor() {    System.out.println("Default constructor");  }  public static void main(String args[]) {    new E01_DefaultConstructor();  }}

    //+M java E01_DefaultConstructor

    **Since we are only creating the DefaultConstructor( ) object for the “side effect” of its construction process, there is no need to create and hold a reference to the object.


    最新回复(0)