I'm new in Java and can not get idea of using packages. Am I stupid or is this some kind of bug?
Guys, how to deal with this error?
C:\Users\batievskiy\IdeaProjects\JavaPset\src>java Test.java
Test.java:1: error: package pkgcalculate does not exist
import pkgcalculate.Calculator;
^
Test.java:5: error: cannot find symbol
Calculator obj = new Calculator();
^
symbol: class Calculator
location: class Test
Test.java:5: error: cannot find symbol
Calculator obj = new Calculator();
^
symbol: class Calculator
location: class Test
3 errors
error: compilation failed
this is Calculator code:
package pkgcalculate;
public class Calculator {
public int add(int a, int b){
return a+b;
}
public static void main(String[] args){
Calculator obj = new Calculator();
System.out.println(obj.add(10, 20));
}
}
from what I got: that I cannot run Test.java from the terminal directly using: java Test.java But if I run Test with Shift + F10, the program is compiled. Why is that? Is it normal behaviour?