• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can not find symble

 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 93
Eclipse IDE Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12196
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be of tremendous help if you posted the exact text of the error.
 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50168
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pauly Bradley, welcome to the Ranch
 
numan ahmad
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
towerofhanoi is an instance method of class tower. That means you need an instance of tower to call that method.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12196
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic