Created
March 18, 2017 00:33
-
-
Save jeffersontpadua/ed8fdf5cee191f3c399377f1af592fb4 to your computer and use it in GitHub Desktop.
Exemplo de como definir métodos em Java
This file contains 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
import java.util.Arrays; | |
import java.util.List; | |
public class Pessoa { | |
public List<Pensamento> pensar(boolean tempoLivre) { | |
if(tempoLivre) { | |
return Arrays.asList(new Pensamento("Livros"), new Pensamento("Estudos")); | |
}else { | |
return Arrays.asList(new Pensamento("Programação"), new Pensamento("Java")); | |
} | |
} | |
private class Pensamento { | |
private String descricao; | |
private Pensamento(String descricao) { | |
this.descricao = descricao; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment