this()
- 생성자에서 다른 생성자 호출할때 사용
- 다른 생성자 호출시 생성자 메서드 내에서 첫 줄에서만 사용가능
class Car2{
String color;
String gearType;
int door;
Car2(){
this("pink","auto",4);
}
// Car2(int d){
// door = d;
// this("pink","auto",door);//에러! 두번째 줄에서 사용안됨
// }
Car2(String color){
this(color,"auto",4);
}
Car2(String c,String g,int d){
color = c;
gearType = g;
door = d;
}
}