returning methods

Solutions on MaxInterview for returning methods by the best coders in the world

showing results for - "returning methods"
Matteo
24 May 2018
1public class App {
2    public static void main(String[] args) 
3    {
4        int x = 3;
5        int answer = addFive(x);
6        System.out.println("answer is = " + answer);
7    }
8
9    private static int addFive(int px) 
10    {
11        px += 5;
12        return px;
13    }
14}
15
Ian
08 May 2019
1public class App {
2    public static void main(String[] args) 
3    {
4        int x=3;
5        int answer = addFive(x);
6        System.out.println("answer is = " + answer);
7    }
8
9    private static int addFive(int px) 
10    {
11        px += 5;
12        return px;
13    }
14}
15
Angel
29 Mar 2017
1public class App {
2    public static void main(String[] args) 
3    {
4        int x = 3;
5        int answer = addFive(x);
6        System.out.println("x = " + answer);
7    }
8
9    private static int addFive(int px) 
10    {
11        x += 5;
12        return px;
13    }
14}
15