fork download
  1. public class Employee{
  2. public String firstName;
  3. public String lastName;
  4. public int age;
  5. public char gender;
  6. public Employee(String firstNameForThisObject,String lastNameForThisObject,char gender){
  7. firstName=firstNameForThisObject;
  8. lastName=lastNameForThisObject;
  9. gender=gender;
  10. }
  11. public static void main(String[]args){
  12. Employee employee= new Employee("firstnameforthisobject","lastnameforthisobject",'m');
  13. System.out.println("firsyt name is"+employee.firstName);
  14. System.out.println("lasty name is"+employee.lastName);
  15. System.out.println("age is"+employee.age);
  16. System.out.println("gender is"+employee.gender);
  17. }
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class Employee is public, should be declared in a file named Employee.java
public class Employee{
       ^
1 error
stdout
Standard output is empty