循环

while

int i = 1 ;

whlie(i<=100){

System.out.println();
i++;

}:

循环条件

循环操作

Scanner input = new Scanner(System.in);
System.out.print("是否合格");
String xx = input.next();
while (!"y".equals(xx)){
    System.out.println("上午读教材下午写代码");
    System.out.print("是否合格");
    xx = input.next();
}
System.out.println("恭喜合格");

程序调试

寻找程序错误的方法

逐条执行寻找问题

能被2整除p%2==0

能被奇数整除 p%2!=0

while 先判断在执行

do while先执行 在判断

for 先判断在执行

break

跳出语句;

使用方式:for(){

if(){

break;

}

}

第二个跳出语句:continue:跳过循环语句体中的剩余语句而执行下次循环

区别

执行语法不通

3.次数确定 for

小写 转大写的方法

c.toUpperCase字符串的方法

字符:char v =input.next().charAt(0){这个转的是1个字符两个字符位1}

增强for循环

for(Administrator(数组变量) a(自己起): p(自己起)){ 不用下标的情况

​ a.aVoid

}

posted @ 2021-12-27 17:44  赎梦  阅读(40)  评论(0)    收藏  举报