標題:
這個Java程式出了什麼問題
[打印本頁]
作者:
花之慶次
時間:
2008-6-9 23:24
標題:
這個Java程式出了什麼問題
class Sample2_06
{
public static void main(String args[])throws
IOException
{
System.out.println("請輸入兩個整數 ");
BufferedReader
br=new
BufferedReader
(new
InputStreamRead
er(System.in));
String str1=br.readLine();
String str2=br.readLine();
int num1=Integer.parseInt(str1);
int num2=Integer.parseInt(str2);
System.out.println("第一個輸入是 " +num1+ " ");
System.out.println("第二個輸入是 " +num2+ " ");
}
}
紅字部份出了問題:
Sample2_06.java:3:cannot find symbol
symbol:class IOException
location:class Sample2_06
public static void main(String args[])throws IOException, 在IOException中就有這符號^指出錯誤
Sample2_06.java:6:cannot find symbol
symbol:class BufferedReader
location:class Sample2_06
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
其他兩個錯誤也是出自於此, 有沒有人知道如何解決這個問題??
作者:
jayzhou_2046
時間:
2008-6-10 23:39
相信閣下是沒有import有關的Class.
import java.io.*;
作者:
花之慶次
時間:
2008-6-12 00:13
引用:
原帖由
jayzhou_2046
於 2008-6-10 23:39 發表
相信閣下是沒有import有關的Class.
import java.io.*;
完全明白!!!Thank You!!!
作者:
4416
時間:
2008-7-5 12:06
你可以用 d IDE 黎寫,
通常遇到D error 時, IDE 都會出埋suggestion 俾你, 都唔駛點 debug !!
試下用Epclise, 好好用!
歡迎光臨 香港 Xocat Forum 討論區 (http://p.xocat.com/p/)
Powered by Discuz! 6.0.0