作者godpro (神)
看板java
標題Re: [問題] 新手讀檔問題
時間Sun Oct 17 19:32:33 2010
程式碼更改後如下
import java.io.*;
public class test {
public static void main(String[] args) {
int num1,num2;
string str;
BufferedReader in = new BufferedReader(new InputStreamReader
(new FileInputStream("input.txt")));
str = in.readLine();
num1 = Integer.parseInt(str);
str = in.readLine();
num2 = Integer.parseInt(str);
num1 = num1 + num2;
System.out.print(num1);
}
}
編譯後會出現
--------------------Configuration: <Default>--------------------
C:\Documents and Settings\Administrator\My Documents\HW01.java:7: cannot find
symbol
symbol : class string
location: class HW01
string str;
^
1 error
是因為沒有 import 什麼東西嗎??
謝謝大大指導!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.252.184.120
→ darkk6:java is case sensitive 10/17 19:57
→ meconin:雖然會變懶,但考慮愛用 eclipse 開發 java 吧 XDD 10/17 20:26
→ cooper6334:學著看error的訊息吧 10/17 23:07
→ cooper6334:他講得很清楚,他不認識string是啥......你s要大寫 10/17 23:15
→ godpro:嗯嗯XD 謝謝各位大大!! 10/17 23:41
推 Apohades:同為學習JAVA的新手淚推Q.Q 真的是很常犯的小錯誤 10/26 19:50