- 1
What is wrong here plis help
public class MyClass { static int sum(int val1, int val2) { return val1 + val2; } } class MainClass{ public static void main(String[ ] args) { //int x = sum(2, 5); //System.out.println(x); sum(2, 3); } }
1 Antwort
+ 3
MainClass cant see function sum because it is in MyClass.
solution: 1 replace sum function into class MainClass.
solution 2: Use MyClass.sum() instead of sum()