본문 바로가기
Class/220728

Class_Inheritance(1-4)

by pms93 2022. 7. 28.
package inheritance1;

public class Professor extends Person {
	private String major;

	public String getMajor() {
		return major;
	}
	public void setMajor(String major) {
		this.major = major;
	}
	
	public void info() {
		System.out.println("이름 : " + super.getAge());
		System.out.println("나이 : " + super.getName());
		System.out.println("전공 : " + major);
		System.out.println();
	}
}

'Class > 220728' 카테고리의 다른 글

Class 예제(1-1)  (0) 2022.07.28
Class_Inheritance(1-5)  (0) 2022.07.28
Class_Inheritance(1-3)  (0) 2022.07.28
Class_Inheritance(1-2)  (0) 2022.07.28
Class_Inheritance(1-1)  (0) 2022.07.28