class hito {
public int age; // public指定のメンバ変数
int sinchou; // 指定なしのメンバ変数
private int taiju; // private指定のメンバ変数
// public指定のメンバ関数
public void show_age() {
System.out.printf("年齢は%dです。", age);
}
// 指定なしのメンバ関数
void show_sinchou() {
System.out.printf("身長は%dです。", sinchou);
}
// private指定のメンバ関数
private void show_taiju() {
System.out.printf("体重は%dです。", taiju);
}
// protected指定のメンバ関数
protected void show() {
System.out.println("protected");
}
}
|