Hi Guys,
new here. Iam doing great so far and was able to get every former Lession to run. But now i have a Problem. First of all (already reported as a Bug) the Video doesnt match the Tasks. Its kindof the same Lession but as a noob i really need this step by step stuff with the exact same tasks. however thats not the problem.
PROBLEM:
THIS IS MY CODE:
public class Calculator {
Calculator() {
}
public int add(int a, int b) {
return a + b;
}
public int subtract(int a, int b) {
return a - b;
}
public int multiply(int a, int b) {
return a * b;
}
public int divide(int a, int b) {
return a / b;
}
public int modulo(int a, int b) {
return a modulo b;
}
}
public static void main(String args) {
Calculator myCalculator = new Calculator;
System.out.println(myCalculator.add(5,7));
System.out.println(myCalculator.substract(45,11));
System
}
THIS IS THE ERROR:
Calculator.java:22: error: ‘;’ expected
return a modulo b;
^
Calculator.java:25: error: class, interface, or enum expected
public static void main(String args) {
^
Calculator.java:27: error: class, interface, or enum expected
System.out.println(myCalculator.add(5,7));
^
Calculator.java:28: error: class, interface, or enum expected
System.out.println(myCalculator.substract(45,11));
^
Calculator.java:29: error: class, interface, or enum expected
System
^
5 errors
QUESTION:
Why does he expect a semicolon after return? how do i use it right?
thanks guys!