*
The moose likes Beginning Java and the fly likes cannot resolve symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot resolve symbol" Watch "cannot resolve symbol" New topic
Author

cannot resolve symbol

vishal mishra
Ranch Hand

Joined: Jul 12, 2010
Posts: 103
Java Compiler is giving Error "cannot resolve symbol while i am trying to compile the file StDemo.java

Here is my program






Please !!! Help Me!!!
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

You can UseCodeTags to post your code (this time I have done it for you )

And are you aware that Java API has a Stack class? So your class Stack would conflict with java.util.Stack.

And You need to post the exact compiler error you see, that will help us to guide you to the solution


Mohamed Sanaulla | My Blog
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14116
    
  16

What is the exact error message and on which line of your source code does it happen? All the details in error messages are important, and give you exact information where and what is wrong. Read the error message carefully.

"Cannot resolve symbol" means that you're using a name (of a variable, method, class etc.) that the compiler doesn't recognize.

Looking at your code, I see at first sight that there are errors on lines 9, 10 and 11 of StDemo. If you want to call the pop() method on your class Stack, you'll need to write that as my.pop(), not my.pop.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ben Ooms
Ranch Hand

Joined: May 16, 2011
Posts: 44

The troubles start at line 2,
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38497
    
  23
You ought to put the [] before the name of the reference. The compiler might not complain, but it is better style.
Then you see you are creating an int[] but assigning it to a st[]. Surely that ought to be a new int[123]?
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

i will just add this. usually when you get that particular compiler error, it means you forgot to import something


SCJP
Visit my download page
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38497
    
  23
Not in this case, I wouldn’t think.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot resolve symbol