欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Java学习与实战心得记录(第12期)

最编程 2024-02-19 14:07:39
...

这个就比较有意思了!所有的事情,拆分完之后,都有且只有这三种状态流程!

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        int i = (int)(Math.random()*6)+1;
        int j = (int)(Math.random()*6)+1;
        int k = (int)(Math.random()*6)+1;

        System.out.println(i);
        System.out.println(j);
        System.out.println(k);

        int count = i+j+k;
        if(count>15){
            System.out.println("运气不错");
        }
        if(count>=10&&count<15){
            System.out.println("运气一般");
        }
        if(count<10){
            System.out.println("运气很差");
        }
    }
}

 break 和continue的区别: