000041:通过本实例可看出while语句与do...while语句的区别

来源:互联网 发布:网络打字员是真的吗 编辑:程序博客网 时间:2024/04/20 02:55
public class Dfference {    public static void main(String args[]) {        int a = 51;        int c = --a;        while (c == 50) {            System.out.println("test");            break;                         //跳出循环,如果不加,将会是死循环        }        int b = 41;        do {            System.out.println("ceshi");  //会打印ceshi            b--;        }        while (b == 40);        }    }
原创粉丝点击