Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Returning methods

public class App {
    public static void main(String[] args) 
    {
        int x = 3;
        int answer = addFive(x);
        System.out.println("answer is = " + answer);
    }

    private static int addFive(int px) 
    {
        px += 5;
        return px;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Returning #methods
ADD COMMENT
Topic
Name
4+6 =