This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Return Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Return " Watch "Return " New topic
Author

Return

Duc Nguy
Greenhorn

Joined: Nov 12, 2001
Posts: 7
it keep asking for return type. What should i put in here to get it to stop the eroor
public static goForward(Drivable sedan)
{
sedan.accelerate();
sedan.decelerate();
}
public static turn(Drivable sedan, int direction)
{
sedan.decelerate();
sedan.turn(direction);
sedan.accelerate();
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

If you don't want to return anything than use the word "void" as the return type.


Please ignore post, I have no idea what I am talking about.
Ben Roy
Ranch Hand

Joined: Nov 01, 2000
Posts: 70
public static goForward(Drivable sedan) {}
should be:
public static < returnTypeGoesHere > goForward(Drivable sedan) {}
If you don't want to return anything, do this:
public static void goForward(Drivable sedan) {}
(edited by Cindy to put spaces by the angle brackets.)

[This message has been edited by Cindy Glass (edited November 14, 2001).]
Ben Roy
Ranch Hand

Joined: Nov 01, 2000
Posts: 70
Heh...apparently this board doesn't have a filter to watch < and > tags. There's also no edit feature. You can ignore the first part of my message where I said it should look like this: and just pay attention to he last line with the void in it.
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

You can edit your post by clicking on the icon with a pencil.
Sadaf Zaidi
Greenhorn

Joined: Oct 09, 2001
Posts: 29
if you want return type then it would be like this
public static int(or any Data type) goForward(Drivable sedan) {}
and if u don't want return type then just put void instead of return type because void doesn't return.
public static void goForward(Drivable sedan) {}


[This message has been edited by Sadaf Zaidi (edited November 14, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Return