Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package KlausurVorbereitung2;
- public class RasenmäherMischung1 extends Thread
- {
- public Rasenmäher r;
- public int wert;
- public RasenmäherMischung1(Rasenmäher r, int wert)
- {
- this.r = r;
- this.wert = wert;
- }
- public void run()
- {
- synchronized (r) {
- while(true)
- {
- r.setAktTank(wert*100);
- System.out.println("betanke Mischung 1: " + r.getAktTank());
- try {
- sleep(2000);
- } catch (InterruptedException e) {
- e.getStackTrace();
- }
- if(r.getAktTank() == r.getTank())
- break;
- r.notify();
- try {
- r.wait();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement