public class Television { private String marca="LG"; private int volumen=6; /** * @return the marca */ public String getMarca() { return marca; } /** * @param marca the marca to set */ public void setMarca(String marca) { this.marca = marca; } /** * @return the volumen */ public int getVolumen() { return volumen; } /** * @param volumen the volumen to set */ public void setVolumen(int volumen) { this.volumen = volumen; } }
public class TelevisionTest { public static void main(String[] args) { Television tv1=new Television(); tv1.setVolumen(5); tv1.setMarca("Sony"); System.out.println(tv1.getVolumen()); System.out.println(tv1.getMarca()); Television tv2=new Television(); tv2.setVolumen(15); System.out.println(tv2.getVolumen()); System.out.println(tv2 .getMarca()); } }