Skip to content

Instantly share code, notes, and snippets.

@thetekst
Created February 21, 2011 05:03
Show Gist options
  • Save thetekst/836673 to your computer and use it in GitHub Desktop.
Save thetekst/836673 to your computer and use it in GitHub Desktop.
exx Crocodile
public class Crocodile {
private long t;
private boolean state;
public Crocodile(){//создание крокодила
}
public double getWeight(){//возвращает вес
return 45;
}
public void kill(){//убить крокодила
}
public String getState(){//получает состояние
return if(state == true){System.out.println("Крокодил жив")}
else{System.out.println("Крокодил мертв")};
}
long tm = System.currentTimeMillis();
public static void main(String args[]) throws InterruptedException{
Crocodile c = new Crocodile();
do{
Thread.sleep(500);//задержка
System.out.println(c.getState());//вывод_состояния_крокодила;
}while(c.getWeight()<100);
c.kill();
//вывод_состояния_крокодила;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment