标签:流程 obj lin efault static manage output def lse
package com.langtao.scanner;
import com.sun.deploy.security.SelectableSecurityManager;
import java.sql.SQLOutput;
import java.util.Scanner;
public class Demo2 {
public static void main(String[] args) {
//New an object of Scanner to receive the input from Keyboard from the user.
Scanner scanner = new Scanner(System.in);
//String str = scanner.nextLine();
//System.out.println(str);
int m = 3;
while(m>0){
System.out.println("Please enter your score: ");
if(scanner.hasNextInt()){
int score = scanner.nextInt();
System.out.println("Your score is: " + score);
switch (score/10){
case 10:
System.out.println("Excellent, full mark!");
break;
case 9:
System.out.println("Very good!");
break;
case 8:
case 7:
System.out.println("Not bad.");
break;
case 6:
System.out.println("Pass!");
break;
default:
System.out.println("Failed");
}
}else{
System.out.println("Invalid entry, please enter your score.");
}
m--;
}
scanner.close();
}
}
标签:流程 obj lin efault static manage output def lse
原文地址:https://www.cnblogs.com/langtaoshuo/p/13951606.html