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);
请问前辈 问题出在哪里?
          ^

解决方案 »

  1.   

    Lenght() 
    换成
    lenght() 
      

  2.   

    s.Lenght()
    改成
    s.lenght()a=charAt(f);
    改成
    a=s.charAt(f);
      

  3.   

    1>    s.length(); 
    2>    a = s.charAt(f);
    3>    public class Hello8(用大写吧) 
      

  4.   


    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();
            System.out.println(s);
            for (int f = 0; f < s.length(); f++) {
                a = s.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 + "个");
        }
    }
      

  5.   

    没用  还是c:\java>javac hello8.java
    hello8.java:14: 找不到符号
    符号: 方法 lenght()
    位置: 类 java.lang.String
    for(int f=0;f<s.lenght();f++){
                   ^
    hello8.java:15: 找不到符号
    符号: 方法 charAt(int)
    位置: 类 hello8
            a=charAt(f);
              ^
    2 错误
      

  6.   

    String s = " ";
            char a = ' ';
            int h, i, j;
            h = i = j = 0;
            System.out.println("请输入一个字符串:");
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            try {
    s = br.readLine();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
            System.out.println(s);
            for (int f = 0; f < s.length(); f++) {
                a = s.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 + "个");这样没错,,我试过了,,,是不是你jdk有问题啊。