The CalculatorDemo1 class
package calc;
public class CalculatorDemo1{
public static void main(String args){
int integer1 = 1;
int integer2 = 2;
Calculator a = new Calculator(integer1, integer2);
a.sum();
}
}
The Calculator class
package calc;
public class Calculator{
int left, right;
public Calculator(int left, int right){
this.left = left;
this.right = right;
}
public void sum(){
System.out.println(this.left + this.right);
}
}
So these codes exist in different files. I tried to compile these two files. One with the constructor compiles, but the other doesn't. And, it spits these errors.
CalculatorDemo1.java:6: error: cannot find symbol
Calculator a = new Calculator(integer1, integer2);
^
symbol: class Calculator
location: class CalculatorDemo1
CalculatorDemo1.java:6: error: cannot find symbol
Calculator a = new Calculator(integer1, integer2);
^
symbol: class Calculator
location: class CalculatorDemo1
2 errors
I don't think this was the problem of the return type. It didn't fix the problem. Also, I checked my identifiers whether I messed up my spelling or not, but there was not any of those. I didn't find any answer from commonly asked question neither. How should I fix this issue?