0

What is the explanation for this programme executing?

Having learnt that code runs left to right and from top to bottom. How is it this code works when the method is called before it has been declared? class Program { public static void main(String[ ] args) { int res = max(7, 42); System.out.println(res); } static int max(int a, int b) { if(a > b) { return a; } else { return b; } } }

18th Aug 2020, 11:59 AM
Michael
Michael - avatar
0 Respuestas