File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Return

 
Duc Nguy
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want to return anything than use the word "void" as the return type.
 
Ben Roy
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can edit your post by clicking on the icon with a pencil.
 
Sadaf Zaidi
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic