請(qǐng)問(wèn)我這段代碼哪里出問(wèn)題了?
package com.practice;
import java.util.Scanner;
//本程序用于練習(xí)try——catch塊語(yǔ)句
public class HelloWorld{
public static void main(String[] args){
try{
Scanner input = new Scanner(System.in);
int num = input.nextInt();
}
catch(InputMismatchException e){
System.out.println("請(qǐng)輸入整數(shù)!");
}
}
}
2016-08-05
沒(méi)有引入 InputMismatchException
import java.util.InputMismatchException;
2022-03-23
嗯新版本的正在籌劃中,敬請(qǐng)關(guān)注慕課網(wǎng)!這個(gè)級(jí)別不好說(shuō),你懂的哈^_^...我做完了再倒回來(lái)做了一遍 在這道題可以輸入了
2016-08-05
2016-08-05
import java.util.InputMismatchException;
2016-08-05
在catch中加入e.printStackTrace();