我想知道这段代码的运行顺序是什么呢?

我想知道这段代码的运行顺序是什么呢?

public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println("第一个地球创建中。。。。");
        Earth e=Earth.returnearth();
        System.out.println("第二个地球创建中。。。。");
        Earth e2=Earth.returnearth();
        System.out.println("第三个地球创建中。。。。");
        Earth e3=Earth.returnearth();
        System.out.println("问:三个地球是同一个么?");
        System.out.println(e);
        System.out.println(e2);
        System.out.println(e3);
            
    }

public class Earth {
     //定义私有构造方法,并在构造方法中打印输出“地球诞生”
    private Earth() {
        System.out.println("地球诞生");
    }
     //定义私有静态类对象并完成实例化
    private static Earth earth=new Earth();
     //定义公有静态方法返回类内的私有静态对象
    static Earth returnearth() {
        return earth;
    }
}



正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
walkingway 2018-02-08 20:39:15

第一个地球创建中。。。。

地球诞生

第二个地球创建中。。。。

第三个地球创建中。。。。

问:三个地球是同一个么?

....

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师