You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
671 B
27 lines
671 B
/* |
|
* To change this license header, choose License Headers in Project Properties. |
|
* To change this template file, choose Tools | Templates |
|
* and open the template in the editor. |
|
*/ |
|
package mt; |
|
|
|
import java.util.logging.Level; |
|
import java.util.logging.Logger; |
|
|
|
/** |
|
* |
|
* @author (C)Y.D.Zakovryashin, 09.01.2023 |
|
*/ |
|
public class Ball { |
|
|
|
public synchronized void hit(String name, int delay) { |
|
System.out.print(name + " -> "); |
|
try { |
|
notify(); |
|
wait(); |
|
Thread.currentThread().sleep(delay); |
|
} catch (InterruptedException ex) { |
|
System.out.println("Exception: " + ex.getMessage()); |
|
} |
|
} |
|
}
|
|
|