Test122 상속&생성자 문제1
package day09;
//상속, 생성자
/*
Point를 상속받아 색을 가진 점을 나타내는 ColorPoint 클래스를 작성하세요.
main()메소드 적힌 코드들을 포함하고 아래와 같은 실행결과 출력되게 만드세요.
실행결과:
RED색의 (10,20)의 점입니다.
*/
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; }
}
public class Test122 {
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+"입니다.");
}
}
Author And Source
이 문제에 관하여(Test122 상속&생성자 문제1), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@jonny77/Test122-상속생성자-문제저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)