day11_TelevisionTest

육희영·2021년 10월 26일
0
package com.java1.day11;

class Television {
	private int channel; // 채널번호
	private int volume; // 볼륨
	private boolean onOff; // 전원상태

	void print() {
		System.out.println("채널은" + channel + "이고 볼륨은" + volume + "입니다.");
	}

	Television(int c, int v, boolean o) {
		channel = c;
		volume = v;
		onOff = o;
	}
}

public class TelevisionTest {

	public static void main(String[] args) {
		Television myTv = new Television(7, 10, true);
		myTv.print();
		Television yourTv = new Television(11, 20, true);
		yourTv.print();
	}

}

출력결과

채널은7이고 볼륨은10입니다.
채널은11이고 볼륨은20입니다.

0개의 댓글

관련 채용 정보