0

Methods & return output question

class MyClass { static int sum(int val1, int val2) { return val1 + val2; } public static void main(String[ ] args) { int x = sum(2, 5); System.out.println(x); } } So the output here is only 7 Shouldnt it be: 7 7 Because there is return val1+val2; and then sopl(x); please solve this query

19th Feb 2018, 6:30 AM
divyam sureka
divyam sureka - avatar
1 Resposta