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입니다.