private String chanl; private String retn; //constructor public Televisi (String channel, boolean inputan, int volume) { vol = volume; on = inputan; chanl = channel; // untuk menampilkan System.out.println ("\n Object Channel Televisi" +channel+ "Sukses dibuat"); } //fungsi public void hidupkan_televisi () { if (on == true) retn = "Televisi Telah Dihidupkan"; else retn = "Televisi Mati"; if (vol > 0) retn += "Dengan Volume" +vol; System.out.println(retn); } public static void main(String[] args) { // TODO code application logic here Televisi ind = new Televisi ("Indosiar", true, 20); ind.hidupkan_televisi(); Televisi sctv = new Televisi ("SCTV", true, 10); sctv.hidupkan_televisi(); Televisi rcti = new Televisi ("RCTI", false, 0); rcti.hidupkan_televisi(); } }
OOP2_Class,Method,Modifier_ShallMee
OOP2_Class,Method,Modifier_ShallMee
OOP2_Class,Method,Modifier_ShallMee