Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TheWalkingDead {
- Pessoa vivo;
- public static void main(String[] args) {
- TheWalkingDead vida = new TheWalkingDead();
- vida.vivo=new Pessoa("José",vida);
- vida.vivo.fale();
- vida.vivo=null;
- while(vida.vivo==null){
- System.out.print(".");
- }
- vida.vivo.fale();
- }
- }
- final class Pessoa {
- String fala;
- TheWalkingDead vida;
- public Pessoa(String nome,TheWalkingDead vida){
- this.vida=vida;
- this.fala = "Ola eu sou o "+nome;
- }
- public void fale() {
- System.out.println(fala);
- }
- @Override
- protected void finalize() throws Throwable {
- System.out.println("\nRessucitando....");
- this.fala="Céeeerebro!!!";
- vida.vivo=this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement