일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- 토큰경제
- html multimedia
- #CallByAddress
- html youtube
- relative path
- #자바상속#자바이즈어#is~a
- #binary
- html charset
- git flow
- #android activity
- border-box
- mac terminal command
- #bubbleSort
- html object
- 하이퍼레저패브릭
- html5 new tag
- #1차원배열
- #2차원배열
- html id
- #C++ 연산자함수오버로딩
- docker example
- #JAVASCRIPT
- #다차원포인터
- hyperledger transaction
- html code
- html plug-in
- #성적관리프로그램
- #C++ has~a
- #3차원배열
- html video
Archives
- Today
- Total
A sentimental robot
Inheritance exercise(2) 본문
public class AA {
private String str;
public AA(String a){ //AA생성자 overloading
str=a;
}
public String getStr(){
return str;
}
}
public class BB extends AA {
private int aa;
public BB(String a,int aa) { //BB 생성자 overloading
super(a); // 부모클래스(AA)가 오버로딩 되었으니 명시적으로 적어준다.
this.aa=aa;
}
public int getAa(){
return aa;
}
}
public class CC extends BB {
public CC(String a, int aa) {
super(a, aa);
}
public static void main(String[] args) {
CC cc = new CC("Superman", 1000);
System.out.println(cc.getStr());
System.out.println(cc.getAa());
}
}
'Java' 카테고리의 다른 글
Abstract class,추상클래스에 대해서 (0) | 2017.12.29 |
---|---|
Overridding, 재정의 (0) | 2017.12.29 |
Inheritance exercise(1) (0) | 2017.12.29 |
Is~a 상속관계 (0) | 2017.12.29 |
Extended.ver (0) | 2017.12.28 |