I'm sure it's something really simple that I'm missing, but after spending a long while going over it, I can't figure out what's wrong. It looks like it should work:
public class HW { public static void main(String args[]) { System.out.println("\nEx0811.JAVA\n"); double num1 = 200; double num2 = 100; Calc.add(num1,num2); Calc.subtract(num1,num2); System.out.println(); } } class Calc { public static void add(double a, double b); { System.out.println(a + b); } public static void subtract(double a, double b); { System.out.println(a - b); } }
It is supposed to display the sum and difference of num1 and num2. But instead, I get these 6 errors:
#
C:\HW.java:35: error: missing method body, or declare abstract
public static void add(double a, double b);
^
C:\HW.java:37: error: cannot find symbol
System.out.println(a + b);
^
symbol: variable a
location: class Calc
C:\HW.java:37: error: cannot find symbol
System.out.println(a + b);
^
symbol: variable b
location: class Calc
C:\HW.java:42: error: missing method body, or declare abstract
public static void subtract(double a, double b);
^
C:\HW.java:44: error: cannot find symbol
System.out.println(a - b);
^
symbol: variable a
location: class Calc
C:\HW.java:44: error: cannot find symbol
System.out.println(a - b);
^
symbol: variable b
location: class Calc
6 errors
Process completed.
Can someone explain what's wrong to me? Any help greatly appreciated.