• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Return

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
 
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't want to return anything than use the word "void" as the return type.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can edit your post by clicking on the icon with a pencil.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic