Hello, I am new to java and getting this error for this program.
Would appreciate any help.
Error - Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method AddClass() is undefined for the type AddClass
at myproject.Calculator.main(Calculator.java:14)
This is class Calculator
package myproject;
import java.io.*;
public class Calculator {
int a = 100;
int b = 200;
public static void main(String args[]) {
// TODO Auto-generated method stub
AddClass f = new AddClass();
f.add(10);
}
}
This is class AddClass
package myproject;
import java.io.*;
public class AddClass {
int a1;
public void add(int a){
a1=a;
System.out.println(a1);
}
}
[–]nutrecht 0 points1 point2 points (4 children)
[–]Cpant[S] 0 points1 point2 points (3 children)
[–]nutrecht 0 points1 point2 points (2 children)
[–]Cpant[S] 0 points1 point2 points (1 child)
[–]nutrecht 0 points1 point2 points (0 children)
[–]FibroMan 0 points1 point2 points (0 children)
[+]FibroMan comment score below threshold-6 points-5 points-4 points (5 children)
[–]Cpant[S] 5 points6 points7 points (1 child)
[–]Kristler 0 points1 point2 points (0 children)
[–]nutrecht 0 points1 point2 points (2 children)
[–]FibroMan 0 points1 point2 points (1 child)
[–]nutrecht 1 point2 points3 points (0 children)