Skip to content

Instantly share code, notes, and snippets.

@manfe
Created July 5, 2013 06:32
Show Gist options
  • Select an option

  • Save manfe/5932399 to your computer and use it in GitHub Desktop.

Select an option

Save manfe/5932399 to your computer and use it in GitHub Desktop.
Aprendendo Java - Detalhado
public interface ControleRemoto {
/*
* Perceba que apenas a assinatura dos métodos estão aqui.
* E cada método termina com um ponto-e-vírgula (;)
*/
void mudarCanal(int canal);
void aumentarVolume (int taxa);
void diminuirVolume (int taxa);
boolean ligar();
boolean desligar();
}
public class Samsung extends TV implements ControleRemoto {
public void desligar() {
System.out.println("Tchau!");
super.setLigada(false);
}
public void ligar() {
super.setLigada(true);
}
public void aumentarVolume(int taxa) { }
public void diminuirVolume(int taxa) { }
public void mudarCanal(int canal) { }
}
public class TV {
private int tamanho;
private int canal;
private int volume;
private boolean ligada;
// abaixo teríamos todos os métodos construtores e get e set...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment