- import java.io.Console;
- public class ch10
- {
- public static void main(String args[])
- {
- Console c=System.console();
- String str;
- int x,y;
- System.out.print("請輸入x的職: ");
- x=Integer.parseInt(c.readLine());
- System.out.print("請輸入y的職: ");
- y=Integer.parseInt(c.readLine());
- if(x==y)
- str="您剛輸入x的值是"+x+",y值為"+y+",x等於y!!";
- else if(x>y)
- str="您剛輸入x的值是"+x+",y值為"+y+",x大於y!!";
- else
- str="您剛輸入x的值是"+x+",y值為"+y+",x小於y!!";
- System.out.printIn(str);
- )
- }
- }
複製代碼 |