fork download
  1. package p1;
  2. public class Sample
  3. {
  4. public static void main(String[] args)
  5. {
  6.  
  7. Employee emp = new Employee(1, "A"); System.out.println(emp.id); }
  8. }
  9. package p2;
  10. class Employee
  11. {
  12. int id;
  13. String name;
  14.  
  15. Employee(int i, String s)
  16. {
  17. id= i;
  18. name = s;
  19. }
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:9: error: class, interface, or enum expected
package p2;
^
1 error
stdout
Standard output is empty