0

IN the below program why we are not using public

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); } }

30th Dec 2018, 1:41 PM
prasanth
prasanth - avatar
1 Answer
+ 5
You don't have to write any access modifier, by default Java methods have package private scope
30th Dec 2018, 1:56 PM
Michal
Michal - avatar