project3 blockchain

【概念】

constructor在main方法外面,main调用constructor来形成object https://blog.csdn.net/caohaicheng/article/details/14147099

public class Platypus {
    String name;
 
    Platypus(String input) {
        name = input;
    }
 
    Platypus() {
        this("John/Mary Doe");
    }
 
    public static void main(String args[]) {
        Platypus p1 = new Platypus("digger");
        Platypus p2 = new Platypus();
        System.out.println(p1.name + "----" + p2.name);
    }
}
--------------------- 
作者:hai_cheng001 
来源:CSDN 
原文:https://blog.csdn.net/caohaicheng/article/details/14147099 
版权声明:本文为博主原创文章,转载请附上博文链接!

【方法论】

【细节】

猜你喜欢

转载自www.cnblogs.com/immiao0319/p/10425211.html