Here's the code :
public class EmployeeTest { public static void main(String args[]){ //System.out.println("hello world"); Employee aEmployee = new Employee("David",1000); System.out.println(aEmployee.getName() + aEmployee.getSalary()); } } class Employee // **why can't I put a "public" here** { // Constructor public Employee(String name, double salary) { this.name = name; this.salary = salary; } // Methods public String getName() { return this.name; } public double getSalary() { return this.salary; } // instance field private String name; private double salary; } My question is : in the second class definition's first line, why can't I put a "public" to define it ? What's the exactly meaning of "public" when using it defines a class ?