Topic: 运行结果出错了.请高手帮下忙看看(cannot resolve symbol - integer)

  Print this page

1.运行结果出错了.请高手帮下忙看看(cannot resolve symbol - integer) Copy to clipboard
Posted by: 小非非
Posted on: 2005-11-05 22:05

是个比较简单的程序为什么运行出错了.汗

import java.io.*;
class Employee
{
private String sName;
private int iAge;
private float fSalary;
public Employee()
{
try
{

BufferedReader inObj=new BufferedReader
(new InputStreamReader(System.in));
System.out.println("请输入职员的姓名:");
sName=inObj.readLine();
System.out.println("请输入职员的年龄:");
iAge=integer.parselnt(inObj.readLine());
System.out.println("请输入职员的月薪:");
fSalary=Float.parseFloat(inObj.readLine());
inObj.close();
}catch(Exception e)
{
System.out.printlnEnvelope;
}
}
public void Display()
{
System.out.println("********显示职员信息**********");
System.out.println("职员的名字是: \t"+sName);
System.out.println("职员的年龄是: \t"+iAge);
System.out.println("职员的月薪是: \t"+fSalary);
}
}

public class JO4_Empl
{
public static void main(String args[])
{
Employee Tom=new Employee();
Tom.Display();
}
}

结果老是显示在17行出错了..提示是:
java:17: cannot resolve symbol
symbol: variable integer
location: calss Emplyee
iAge=integer.parselnt(inObj.readLine());
请高手帮看看啊我看了好久就是不明白为什么这里错了...

2.Re:运行结果出错了.请高手帮下忙看看 [Re: 小非非] Copy to clipboard
Posted by: bluecrystal
Posted on: 2005-11-06 00:06

Integer是一个类,请首字母大写

3.Re:运行结果出错了.请高手帮下忙看看 [Re: 小非非] Copy to clipboard
Posted by: q_yuan
Posted on: 2005-11-06 00:10

//iAge=integer.parselnt(inObj.readLine());
应改成:
iAge=Integer.parselnt(inObj.readLine());

4.Re:运行结果出错了.请高手帮下忙看看 [Re: 小非非] Copy to clipboard
Posted by: 小非非
Posted on: 2005-11-06 17:07

我试试...谢谢大家帮忙

5.Re:运行结果出错了.请高手帮下忙看看 [Re: 小非非] Copy to clipboard
Posted by: 小非非
Posted on: 2005-11-06 17:16

这次又出新问题了.前面那个改了..结果

还是在17行上的问题:

symbol: method parselnt (java.lang.String)
location: class java.lang.Integer
iAge=Integer.parselnt(inObj.readLine());

这次是直在那个Integer后面的那个"."上..好奇怪...

6.Re:运行结果出错了.请高手帮下忙看看(method parselnt) [Re: 小非非] Copy to clipboard
Posted by: why
Posted on: 2005-11-06 19:45

小非非 wrote:
这次又出新问题了.前面那个改了..结果

还是在17行上的问题:

symbol: method parselnt (java.lang.String)
location: class java.lang.Integer
iAge=Integer.parselnt(inObj.readLine());

这次是直在那个Integer后面的那个"."上..好奇怪...

It's parseInt (I for Ivy), not parselnt (l for lion)

7.Re:运行结果出错了.请高手帮下忙看看(cannot resolve symbol - integer) [Re: 小非非] Copy to clipboard
Posted by: 小非非
Posted on: 2005-11-07 09:19

编译出来了啊..很奇怪哦..书里明明是这么写的..为什么是parseInt呢???能解释下吗?谢谢帮忙

8.Re:运行结果出错了.请高手帮下忙看看(cannot resolve symbol - integer) [Re: 小非非] Copy to clipboard
Posted by: wzl0917
Posted on: 2005-11-08 13:35

尽信书,不如无书!
上面斑竹已经说的很清楚了!
下次看书一定要擦亮眼睛看!
再试下吧!

9.Re:运行结果出错了.请高手帮下忙看看(cannot resolve symbol - integer) [Re: 小非非] Copy to clipboard
Posted by: 小非非
Posted on: 2005-11-08 19:36

谢谢大家..弄出来了..以后一定要擦亮眼睛看了啊...


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923