import java.util.Scanner;
public class T69 {
static String S = new String();
public static int makeInt(){
int n=0;
int tein=1;
int i=S.lenght()-1;
while(i>0){
n+=tein*(int)S.charAt(i);
tein*=10;
i--;
}
return n;
}
public static void main(String[]args) {
Scanner cin = new Scanner(System.in);
String S = cin.nextLine();
int f = S.makeInt();
}
}
錯誤:
T69.java:12: error: cannot find symbol
int i=S.lenght()-1;
^
symbol: method lenght()
location: variable S of type String
T69.java:24: error: cannot find symbol
int f = S.makeInt();
^
symbol: method makeInt()
location: variable S of type String
2 errors
您不慎左's.lenght()'在乾淨的代碼:) – 2011-12-22 18:13:36
感謝@BeauGrantham – 2011-12-22 18:14:12
第二個感謝,@BeauGrantham – 2011-12-22 18:14:56