[Java] 상속(Inheritance) - (2)super, super(), 오버라이딩
1. super 부모클래스로부터 상속받은 필드나 메소드를 자식 클래스에서 참조하는 참조변수이다. 부모 클래스의 멤버와 자식클래스의 멤버 이름이 같을 경우 super를 통해 부모 클래스의 멤버에 접근 할 수 있다. 인스턴스 메소드에만 사용 가능하며 클래스 메소드에는 사용할 수 없다. class Parent { int num = 5; } class Child extends Parent { int num = 10; void print() { System.out.println(num);//10 System.out.println(this.num);//10 System.out.println(super.num);//5 } } public class Ex01 { public static void main(String[..
JAVA
2022. 3. 30. 09:24
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 멀티계정
- amazon eventbridge
- eclipse
- 티스토리챌린지
- 리눅스
- 상속
- MSA
- smart tomcat
- the given id must not be null
- springboot
- ssh-key
- 메소드
- 객체
- git계정여러개
- linux
- 파이썬
- 생성자
- 자바
- msa전환
- 이클립스
- 오버로딩
- 명령어
- 다형성
- 모놀리식vsmsa
- git계정
- spring
- 오블완
- jdk설치
- 폴더개수
- java
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함