File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot find symbol" Watch "cannot find symbol" New topic
Author

cannot find symbol

Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
I get error for cannot find symbol for the setNumOne in my test program
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  17

You declare numOne and numTwo incorrectly. (Actually you don't declare them at all).

Take a look at lines 23 and 24, and see what you can change.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

What's this ?


[My Blog]
All roads lead to JavaRanch
Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
With newOne I was trying to instantiate the first set to store a set of numbers that would be tested along with the other set setTwo
Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
Is it supposed to look something like this?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

How do yo declare a variable ? You declare the variable type and its name. Is "numOne" a valid type ?
Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
How about this, I guess I may have forgotten about getting rid of the b
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Think again You want to use two UnorderedSet. One is called numOne, another one is called numTwo. How do you declare an UnorderedSet whose name is "numOne" ? How do you declare an UnorderedSet of Strings whose name is "numOne" ?

How do you declare an int whose name is "count" ? -> int count. Apply the same rule above.
Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
OH! So it can be declared just like any other variable, I get what your saying! Since it's a string I wouldn't need the <T>?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Close. It's not a String. It's an UnorderedSet of Strings : UnorderedSet<String>.
Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
numOne = new UnorderedSet<String> Just got off work and now I have a compiler I can use, which still doesn't like the code.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Dustin Schreader wrote:numOne = new UnorderedSet<String> Just got off work and now I have a compiler I can use, which still doesn't like the code.


Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
Thank you for the Help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot find symbol