import java.io.*;
public class hello8
{
public static void main(String args[])throws NumberFormatException,
IOException
{
String s=" ";
char a=' ';
int h,i,j;
h=i=j=0;
System.out.println("请输入一个字符串:");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
s=br.readLine();
for(int f=0;f <s.Lenght();f++){
a=charAt(f);
if(a>'a'&&a <'z')
h++;
else
if(a>'0'&&a <'9')
i++;
else
j++;
}
System.out.println("字母"+h+"个");
System.out.println("数字"+i+"个");
System.out.println("其他字符"+j+"个");
}
}
这个总是出现这个错误:
c:\java>javac hello8.java
hello8.java:15: 找不到符号
符号: 方法 Lenght()
位置: 类 java.lang.String
for(int f=0;f <s.Lenght();f++
^
hello8.java:16: 找不到符号
符号: 方法 charAt(int)
位置: 类 hello8
a=charAt(f);