作者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
1F:→ darkk6:java is case sensitive 10/17 19:57
2F:→ meconin:虽然会变懒,但考虑爱用 eclipse 开发 java 吧 XDD 10/17 20:26
3F:→ cooper6334:学着看error的讯息吧 10/17 23:07
4F:→ cooper6334:他讲得很清楚,他不认识string是啥......你s要大写 10/17 23:15
5F:→ godpro:嗯嗯XD 谢谢各位大大!! 10/17 23:41
6F:推 Apohades:同为学习JAVA的新手泪推Q.Q 真的是很常犯的小错误 10/26 19:50