```
package edu.xcdq;
import java.util.Scanner;
public class Demo01 {
public static void main(String[] args){
String answer;
Scanner input =new Scanner(System.in);
System.out.print("合格了吗?(y/n):");
answer = input.next();
while (!"y".equals(answer)){
System.out.println("上午阅读教材");
System.out.println("下午上机编程");
System.out.println("合格了吗?(y/n):");
answer=input.next();
}
System.out.println("恭喜你及格了");
}
}
```