• Post Reply Bookmark Topic Watch Topic
  • New Topic

a question about returning  RSS feed

 
Ranch Hand
Posts: 291
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
made this simple silly code:



but where is 777 ...how can i make use of the return int?
how can i print it out...or do something?

 
Bartender
Posts: 1664
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically, you would do something like this :


You might want to look at https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
 
jon ninpoja
Ranch Hand
Posts: 291
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok so all thats really doing is assigning the return value to a variable thats in the main method scope right?
 
salvin francis
Bartender
Posts: 1664
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jon ninpoja wrote:ok so all thats really doing is assigning the return value to a variable thats in the main method scope right?

Correct.

A method is like a machine that does some kind of logic. You provide inputs to it via parameters and it returns it's computed value.
 
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jon ninpoja wrote:
how can i print it out...or do something?

Surely by now you know how to print something out to the console... 
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to return  it, and to be printed, you need to add this.



 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!