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
| interface IPopulacao { // note o prefixo I, de interface | |
| void contar(); | |
| } |
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
| class Aviao { | |
| void decola() { ... } | |
| void pousa() { ... } | |
| } |
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
| double vlrRef; // péssimo | |
| double valorDeReferencia; // melhor | |
| String dataNasc; // ruim | |
| String dataDeNascimento; // melhor | |
| int iu; // horrível | |
| int identificacaoUnica; // melhor | |
| ContratoUnico cu; // sem comentários |
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
| class Usuario { | |
| // ... | |
| List<Tarefa> getTarefasRecentes() { ... } | |
| List<Tarefa> getTarefasEmAndamento() { ... } | |
| List<Tarefa> getTarefasCanceladas() { ... } | |
| // ... | |
| } |
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
| class Usuario { | |
| // ... | |
| Historico getUltimoHistorico() { ... } | |
| List<Historico> getTodosHistoricos() { ... } | |
| // ... | |
| } |
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 List<Conta> getCP() { | |
| List<Conta> c1 = new ArrayList<Conta>(); | |
| for (Conta c2 : cs) if (c2.getTipo() == 2) c1.add(c2); | |
| return c1; | |
| } |
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
| // variável comentada: má opção | |
| int d; // tempo decorrido em dias | |
| // variável com nome pronunciável | |
| int tempoDecorrido; | |
| // adicionando informações extras à variável |
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
| class Documento | |
| attr_accessor :titulo, :conteudo ### declaração de atributos | |
| ### métodos escritos em minúsculas com underline e, | |
| ### quando boleanos, terminam com "?" | |
| def sem_titulo? | |
| return @titulo.nil? || @titulo.empty? | |
| end | |
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
| class Endereco { | |
| private String rua; | |
| private int numero; | |
| private boolean ativo; | |
| public String getRua() { return rua; } | |
| public void setRua(String rua) { this.rua = rua; } | |
| public int getNumero() { return numero; } |
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 static void armazena(String texto) throws Exception { | |
| FileWriter fw = new FileWriter("/tmp/app-temp.txt", true); | |
| fw.write(s); | |
| fw.flush(); | |
| fw.close(); | |
| } | |
| public static String recupera() throws Exception { | |
| BufferedReader br = new BufferedReader(new FileReader("/tmp/app-temp.txt")); | |
| String linha = null; |