import java.util.*;
import java.lang.*;
import java.io.*;
class Human {
//クラス内変数宣言するニダ
private String name;
private int age;
private char gender;
public Human(String name,int age,char gender) {
this.name = name;
this.age = age;
this.gender = gender;//M,Wで判別するニダ
}
public String getName() {
return this.name;
}
public int getAge() {
return this.age;
}
public char getGender() {
return this.gender;
}
}
class Student extends Human {
//継承ニダ
private int number;
public Student(String name,int age,char gender,int number) {
super(name, age, gender);
this.number = number;
}
public int getNumber() {
return this.number;
}
}
class Main {
public static void main(String[] args) {
Student s = new Student("田中", 20, 'M', 1);
System.out.println(s.getName());
System.out.println(s.getAge());
System.out.println(s.getGender());
System.out.println(s.getNumber());
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: