fork download
  1. public class Person {
  2. public String name ;
  3. public int alter ;
  4. public Person ( String name , int alter ) {
  5. this . name = name ;
  6. this . alter = alter ;
  7. }
  8. }
  9.  
  10. public class Student extends Person {
  11. public int matrikelNr ;
  12. public Student ( String name , int alter , int mNr ) {
  13. super ( name , alter );
  14. this . matrikelNr = mNr ;
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class Person is public, should be declared in a file named Person.java
public class Person {
       ^
Main.java:10: error: class Student is public, should be declared in a file named Student.java
public class Student extends Person {
       ^
2 errors
stdout
Standard output is empty