Re: [問題] 新手讀檔問題
程式碼更改後如下
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
10/17 19:57, 1F
→
10/17 20:26, , 2F
10/17 20:26, 2F
→
10/17 23:07, , 3F
10/17 23:07, 3F
→
10/17 23:15, , 4F
10/17 23:15, 4F
→
10/17 23:41, , 5F
10/17 23:41, 5F
推
10/26 19:50, , 6F
10/26 19:50, 6F
討論串 (同標題文章)