Created
July 5, 2013 06:21
-
-
Save manfe/5932351 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 class Eletrodomestico { | |
| protected boolean ligado; | |
| protected int voltagem; | |
| protected int consumo; | |
| // getters e setters | |
| // ... | |
| } |
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 Main { | |
| public static void main(String[] args) { | |
| TV t1 = new TV(); | |
| t1.ligado = false; | |
| t1.voltagem = 110; | |
| t1.tamanho = 20; | |
| System.out.println("Ligado: " + t1.ligado); | |
| } | |
| } |
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 extends Eletrodomestico { | |
| private int canal; | |
| private int volume; | |
| private int tamanho; | |
| public TV() { | |
| } | |
| // (...) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment