Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem Code

 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with this code:


I get the error message:
invalid method declaration; return type required
public Robot()
What am I doing wrong, am I somehow using RObot wrong or some other error that I can't see.

On another note can you tell me if I've made any other errors too.

Thanks a lot!
[ February 13, 2005: Message edited by: Atrus Greyor ]
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is Robot supposed to be an inner class? If so, you need

public class Robot

rather than public Robot().

On the other hand, if public Robot() is supposed to be a method, then you can't say

new Robot()
[ February 13, 2005: Message edited by: Marilyn de Queiroz ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marilyn de Queiroz:

On the other hand, if public Robot() is supposed to be a method, then you can't say

new Robot()


And you need to specify a return type in the method declaration, such as

public void robot() ...

(method names typically start with a lower case character)
 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then how wold I call it.
Sorry Brain Freeze here for me...
Heres the updated code if you would like to see...


Now it "cannot resolve symbol" but it's there in the API...
Sigh, I think I've just really confused myself

Thanks for all your help
[ February 15, 2005: Message edited by: Atrus Greyor ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


On line 26, you're using the new keyword. It says you want to instanciate a new object from the Robot class.
Nowhere in your code is there a Robot class.
This class is named GotoProg.
You do have a robot method which returns void.

Can you write down exactly what you want the code to do?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic