Re: [問題] 新手讀檔問題

看板java作者 (神)時間15年前 (2010/10/17 19:32), 編輯推噓1(105)
留言6則, 5人參與, 最新討論串2/2 (看更多)
程式碼更改後如下 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

10/17 19:57, , 1F
java is case sensitive
10/17 19:57, 1F

10/17 20:26, , 2F
雖然會變懶,但考慮愛用 eclipse 開發 java 吧 XDD
10/17 20:26, 2F

10/17 23:07, , 3F
學著看error的訊息吧
10/17 23:07, 3F

10/17 23:15, , 4F
他講得很清楚,他不認識string是啥......你s要大寫
10/17 23:15, 4F

10/17 23:41, , 5F
嗯嗯XD 謝謝各位大大!!
10/17 23:41, 5F

10/26 19:50, , 6F
同為學習JAVA的新手淚推Q.Q 真的是很常犯的小錯誤
10/26 19:50, 6F
文章代碼(AID): #1CkjxKST (java)
文章代碼(AID): #1CkjxKST (java)