dqy16_Shape

육희영·2021년 10월 28일
0
package com.java1.day16;

abstract class Shape {
	private int x, y;
	public void move(int x, int y) {
		this.x = x;
		this.y = y;
	}
	public abstract void draw();
}

class Rectangle extends Shape {
	private int width, height;

	public void draw() { // 추상 메소드 구현
		System.out.println("사각형 그리기 메소드");
	}
}

class Circle extends Shape {
	private int radius;
	public void draw() {
		System.out.println("원 그리기 메소드");
	}
}

0개의 댓글

관련 채용 정보