package cn.save;java
import java.util.Scanner;對象
public class Dome1 {
public static void main(String[] args){
Scanner input = new Scanner(System.in);//建立掃描儀對象 Scanner input =new Scanner(System.in)
System.out.println("請輸入性別:");
//char gender=input.next().charAt(0);//聲明成績變量並鍵盤輸入值 char gender =input.next().charAt(0);
String gender=input.next(); // if(gender == '男'){}
System.out.println("請輸入成績:");
double time =input.nextDouble();
if(gender.equals("男")){//String 比較內容用equals("男")
//char類型 gender == '男'
if(time<9){
//進行比賽
System.out.println("恭喜進入男子組比賽");
}else{
System.out.println("淘汰");
}
}
if(gender.equals("女")){//String 比較內容用equals("女")
//char類型 gender == '女'
if(time<10){
//進行比賽
System.out.println("恭喜進入女子組比賽");
}else{
System.out.println("淘汰");
}
}
}
}input