createTable(table);
private void createTable()throws Exception

解决方案 »

  1.   

    新的:还是有错,说是SYMBOL不能识别
    import java.util.*;
    import java.io.*;
    public class HashTest
    { private Hashtable table;
    public HashTest()
    {
    // super("Word Type Count");
    table = new Hashtable();
    createTable();
    createOutput();
    }
    private void createTable()throws Exception
    {
    BufferedReader br = new BufferedReader
        (new InputStreamReader(System.in));
        String input = br.readLine();
        StringTokenizer words = new StringTokenizer(input,"\n\t\r");
        while ( words.hasMoreTokens() ) {
             String word = words.nextToken().toLowerCase();
        if (talbe.containsKey(word))
        {
         Integer count = (Integer)table.get(word);
         table.put(word,new Integer(count.intValue()+1));
        }
        else
        table.put(word, new Integer(1));   
    }
    }private String createOutput() {      
       //   String output = "";
          Enumeration keys = table.keys();
                   
          // iterate through the keys
          while ( keys.hasMoreElements() ) {
             Object currentKey = keys.nextElement();
             System.out.println(currentKey+"\t"+table.get(currentKey)+"\n");
             }
             System.out.println("size: " +table.size()+"\n");
             System.out.println("isEmpty: "+table.isEmpty()+"\n");
             }
              public static void main( String args[] )
       {
          HashTest application = new HashTest();
         
       }
       }
      

  2.   

    不行啊,方法调用早改了,手物,参数createTable(table);
    改了,该是 17,52行的错误,IDENTIFIER EXPECTED, 53 REQUIRED TO ADD A ]OR[
      

  3.   

    在构造函数中createTable()方法的时候,\你是不是该捕获一下异常阿?try catch一下阿?
      

  4.   

    不是EXCEPTION的错,是根本不能COMPLY呢,连IDENTIFIER都有问题
      

  5.   

    no.15 line
    private void createTable(table)throws Exception
    description: <identifier>expected
    no.51 line }
    description: "]"expected
      

  6.   

    你看看15行createTable(table)后面是不是应该有个空格,然后再throws????
      

  7.   

    1)构造函数 and Main() 需加:throws java.lang.Exception2)private String createOutput() --> private void createOutput() 
    3)createTable()中的 {
    if (talbe.containsKey(word))  ---> table (not 'talbe')
        {
         Integer count = (Integer)table.get(word);
         table.put(word,new Integer(count.intValue()+1));
        }你用的jbuilder吧?再要是有此错误,建议你删了重来一个全新的
      

  8.   

    你好像把createOutput放到了class外,把createOutput上面那个{去掉