Really simple problem i expect - cannot resolve symbol

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adamrace
    New Member
    • May 2007
    • 3

    Really simple problem i expect - cannot resolve symbol

    Hi,

    i am fairly new to java and have been stuck on this for ages, basically i need to create a new object which gets a list of data from a text file, so i have this

    Code:
    import java.io.*;
    
    import java.util.*;
    
    public class Tester {
    
    public static void main( String args[] ) {
    
    File checkerFile = new File("dictionary.txt");
    
    Dictionary aDictionary = new Dictionary(checkerFile);
    
    
    }
    
    }
    And ive tried many different ways of writing it but i dont understand why it wont create the object, it just says the error message.

    ...\Tester.java :17: cannot resolve symbol
    symbol : constructor Dictionary (java.io.File)
    location: class Dictionary
    Dictionary aDictionary = new Dictionary(dict ionaryFile);

    Thanks for any help
  • prometheuzz
    Recognized Expert New Member
    • Apr 2007
    • 197

    #2
    Originally posted by adamrace
    Hi,

    ...

    ...\Tester.java :17: cannot resolve symbol
    symbol : constructor Dictionary (java.io.File)
    location: class Dictionary
    Dictionary aDictionary = new Dictionary(dict ionaryFile);

    Thanks for any help
    What the compiler is telling you is that it can't find a constructor in your Dictionary class which takes a java.io.File object as a parameter.

    Comment

    • adamrace
      New Member
      • May 2007
      • 3

      #3
      Ah ok i understand thanks, ive looked in the dictionary class and it has this.

      Code:
      public Dictionary( String fileName )
      Does this mean that you just need the name of the file rather than the file opened itself and then open it later? How would you implement it into the other code?

      Thanks for your help

      Comment

      • prometheuzz
        Recognized Expert New Member
        • Apr 2007
        • 197

        #4
        Originally posted by adamrace
        Ah ok i understand thanks, ive looked in the dictionary class and it has this.

        Code:
        public Dictionary( String fileName )
        Does this mean that you just need the name of the file rather than the file ...
        That can be easily answered by trying to do that and see if the compiler has no objections.

        Comment

        Working...