我怎麼能說以下內容:雖然不是條件
while(input is not an int){
do this
}
我想這個代碼,但我知道這是錯誤的:
int identificationnumber;
Scanner sc3 = new Scanner(System.in);
identificationnumber = sc3.nextInt();
while(identificationnumber != int){ // this line is wrong
Scanner sc4 = new Scanner(System.in);
identificationnumber = sc4.nextInt();
}
任何建議please.Thanks。
因此你得到一個int並且想檢查它是否不是一個?那麼還有什麼呢? – guitarflow 2012-02-09 00:49:10
http://stackoverflow.com/questions/2674554/how-know-a-variable-type-in-java – AJP 2012-02-09 00:50:47