Advertisement
karbaev

practice23

Jun 30th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. public class Person {
  2.     String name;
  3.     public Person(String s){
  4.         name=s;
  5.     }
  6. }
  7.  
  8. //должен быть в отдельном файле
  9. public class Student extends Person{
  10.     int id;
  11.     public Student(String s, int n) {
  12.         super(s);
  13.         id=n;
  14.     }
  15.  
  16.     public String toString(){
  17.         return "This is student: "+name;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement