/*import java.util.*;
public void show() //메소드 오버라이딩 (재정의)
{
super.show();
System.out.println(color);
}
}
class TV {
private int size;
public TV(int size) {this.size = size;}
int getSize( ) { return size;}
}
class ColorTV extends TV {
private int color;
public ColorTV(int size,int color) {
super(size);
this.color = color;
}
public void printProperty(){
System.out.print(getSize()+"인치" + color + "컬러");
}
}
class IPTV extends ColorTV {
private String ip;
public IPTV(String ip, int size, int color) {
super(size,color);
this.ip = ip;
}
public void printProperty() {
System.out.print("나의 IPTV는" + ip + "주소의 ");
super.printProperty();
}
}
class Main {
public static void main(String[] args) {
IPTV iptv = new IPTV("255.255.255.255", 2147483647 , 2147483647);
iptv.printProperty();
}
}
/*
class onepen {
int amount; //남은 양
private int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
}
class SharpPencil extends onepen {
private int width;
}
class BallPen extends onepen {
private String color; //색
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
class FountainPen extends BallPen {
public void refill(int n) {amount = n;}
}
*/
class Point {
private int x,y;
public Point(int x, int y){
this.x = x;
this.y = y;
}
public int getX() { return x; }
public int getY() { return y; }
protected void move(int x , int y) { this.x = x; this.y = y;}
}
class ColorPoint extends Point {
private String color;
public ColorPoint(int x, int y, String color){
super(x,y);
this.color = color;
}
public void setXY(int x , int y) {
move(x,y);
}
public void setColor(String color) {
this.color = color;
}
public String toString() {
return color + "색의 (" + getX() + "," + getY() + ")의 점";
}
}
public class Main {
public static void main(String[] args) {
ColorPoint cp = new ColorPoint(5,5,"YELLOW");
cp.setXY(10,20);
cp.setColor("RED");
String str = cp.toString();
System.out.println(str + "입니다.");
}
}