import java.io.*;
class TryTest
{
public static void main(String[] args)
{
int a;
String s= "abc ";
try
{
a=Integer.parselnt( "123 ");
System.out.println( "a= "+a);
a=Integer.parselnt(s);
}
catch(NumberFormatException e)
{
System.out.println( "NumberFormatException: "+s+ "can 't convert to integer ");
}
finally
{
System.out.println( "GOODBYE. ");
}
}
}
出现如下错误
D:\MyJava> javac TryTest.java
TryTest.java:12: cannot resolve symbol
symbol : method parselnt (java.lang.String)
location: class java.lang.Integer
a=Integer.parselnt( "123 ");
^
TryTest.java:14: cannot resolve symbol
symbol : method parselnt (java.lang.String)
location: class java.lang.Integer
a=Integer.parselnt(s);
^
2 errors
如何改正,刚开始学,问题好多啊...希望大家谅解。。。
------解决方案--------------------
拼错了
parselnt,改为parseInt
你把I写作l了