I am using a Mac osx 10.10.5 Yosemite, and I am trying to run my short Java program using Terminal. I first entered: "emacs Salary.java". Then: "javac /Users/username/Documents/Salary.java". And finally: "java Salary". It created a .class file for my java program, yet it says "
Error: Could not find or load main class Salary"
after I try running it. Am I doing something wrong? I checked the directories and it's in the correct place. The code is provided below, thank you in advance:
public class Salary {
public static void main (String [] args) {
int hourlyWage = 20;
System.out.print("Annual salary is: ");
System.out.println(hourlyWage * 40 * 50);
System.out.print("Monthly salary is: ");
System.out.print((hourlyWage * 40 * 50) / 12);
return;
}
}