*
The moose likes Beginning Java and the fly likes can not find symble Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can not find symble" Watch "can not find symble" New topic
Author

can not find symble

numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
hay friends please help me.i am new in java and making a program of" tower of Hanoi" but it is not compiling and giving me an error please check it and feed me back thanks in advance.


Aditya Sirohi
Ranch Hand

Joined: Jan 05, 2010
Posts: 93

Hi Numan,

You are using recursion here. you should have a method in the class called towerofhanoi(), which takes in four arguments that you are passing here , i.e. towerofhanoi(n - 1, beg, end, aux); Hope this helps.

-Aditya
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11170
    
  16

It would be of tremendous help if you posted the exact text of the error.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
Aditya Sirohi wrote:Hi Numan,

You are using recursion here. you should have a method in the class called towerofhanoi(), which takes in four arguments that you are passing here , i.e. towerofhanoi(n - 1, beg, end, aux); Hope this helps.

-Aditya

yes i am using recursion but sorry i did not get you exactly


please help me and reply me I wouldn't be here if I didn't need help.....
pauly bradley
Greenhorn

Joined: May 17, 2011
Posts: 8
On lines 13, 19 and 22, are the calls to:

towerofhanoi(n, beg, aux, end)

supposed to be methods or constructors. What relevance is there to the arguments passed to them and the instance variables of the same name in the class?

This code fragment doesn't contain enough info to be sure which error you're talking about?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
Pauly Bradley, welcome to the Ranch
numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
pauly bradley wrote:On lines 13, 19 and 22, are the calls to:

towerofhanoi(n, beg, aux, end)

supposed to be methods or constructors. What relevance is there to the arguments passed to them and the instance variables of the same name in the class?

This code fragment doesn't contain enough info to be sure which error you're talking about?


thanks



i did it but its not working again


Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

towerofhanoi is an instance method of class tower. That means you need an instance of tower to call that method.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11170
    
  16

numan ahmad wrote:
i did it but its not working again

please consider reading ItDoesntWorkIsUseless. What you have posted really doesn't help us help you at all.

Does it compile? does it crash when you run it? Does it run but gives the wrong output?

Your job when asking a question is to make it as EASY as possible for me to help you. simply posting 30 lines of code and saying "this doesn't work" makes it quite HARD for me to help you.
numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
fred rosenberger wrote:
numan ahmad wrote:
i did it but its not working again

please consider reading ItDoesntWorkIsUseless. What you have posted really doesn't help us help you at all.

Does it compile? does it crash when you run it? Does it run but gives the wrong output?

Your job when asking a question is to make it as EASY as possible for me to help you. simply posting 30 lines of code and saying "this doesn't work" makes it quite HARD for me to help you.


hmmm yesterday my class teacher gave me an assignment of tower of Hanoi...before this he gave me an overview and understand its algorithm.....when i start coding and compile it first time it gave me an error of that symbol not find (symble1 method not find).after that i made a method in it i.e tower() and compile it got an error which was something like that

tower.java:7: ';' expected
tower(){
tower.java:12: '.class' expected



now sir please told me where i am wrong and what should i have to do in it....?
numan ahmad
Ranch Hand

Joined: Jan 27, 2011
Posts: 49
Rob Spoor wrote:towerofhanoi is an instance method of class tower. That means you need an instance of tower to call that method.




but i am implementing it by using stack respected sir according to my knowledge in stack there is no instance of class.....?? is am i rite?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11170
    
  16

That's because this line:



doesn't make any sense. What are you trying to do here - define a method? Call one? create a new class? declare a member variable?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can not find symble
 
Similar Threads
Java Code Generator
how to calculate the N to the power of N
Tower of hanoi
Java program to Convert java.lang.String to java.sql.CLOB Object
Library System