wood burning stoves*
The moose likes Beginning Java and the fly likes Return types and methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Return types and methods" Watch "Return types and methods" New topic
Author

Return types and methods

Alix Ollivier
Ranch Hand

Joined: Jun 04, 2012
Posts: 71

Each time I want to move my character in the game I am building, I do code like this. and I write goLeft like this:

Is this correct, to call a return and have it call to itself? Or is there a way I can simply call goLeft without the accompanying coordinateX=? Coordinate X and Y are outside of the method.


"The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!', but 'That's funny...' "
- Isaac Asimov
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

I wouldn't call it incorrect but I think a more elegant approach would be


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I would just do this:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Return types and methods
 
Similar Threads
regarding long and float
what this signature means?
convert scientific notation number format to normal number format
My code should draw Julia set but instead it does not draw anything
the code does not call paint method