为了账号安全,请及时绑定邮箱和手机立即绑定

String 能更新么

public class HelloWorld {

    public static void main(String[] args) {

int age=25;

    if (age>60) {

            String note = "老年";

            System.out.println(note);

    }

    else if ((age>40)&&(age<60)){

        note = "中年";

        System.out.println(note);

    }

    else if ((age>18)&&(age<40)){

        note = "少年";

        System.out.println(note);

    }

    else{

        note = "童年";

        System.out.println(note);

    }

    

    

}

}

int 的时候这样写可以, string就不能更新?

正在回答

2 回答

没必要写xx=xx,直接在System.out.println("xx")就好了.

0 回复 有任何疑惑可以回复我~

我把 String 写 if 里了

1 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

String 能更新么

我要回答 关注问题
微信客服

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

帮助反馈 APP下载

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

公众号

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