Common Mistakes

  • Forgetting to declare your variables. cannot find symbol
    symbol  : variable count
    location: class Histo
            count = new ArrayList<Integer>(10);
  • Not importing a class: cannot find symbol
    symbol  : class Scanner
    location: class Histo
            Scanner data = null;
  • Forgetting to use the new keyword to create an object. Here’s an example of the error message that occurs when you forget to use the new keyword. Notice that the message is pretty unhelpful. Java thinks you are trying to call the Method Scanner, but there are two problems. First Scanner is not really a method it is a constructor.: cannot find symbol
    symbol  : method Scanner(
    location: class Histo
                    data = Scanner(new File("test.dat"));
  • Forgetting a Semicolon:
    ';' expected
  • Forgetting to declare the kind of object in a container.:

    Note: uses unchecked or unsafe operations. Note:
    Recompile with -Xlint:unchecked for details.
You have attempted of activities on this page