Created
July 5, 2013 06:32
-
-
Save manfe/5932399 to your computer and use it in GitHub Desktop.
Aprendendo Java - Detalhado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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