Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.Closeable;
- public class SomeClass extends Thread implements Closeable, AutoCloseable {
- private Boolean isActive = true;
- public void run() {
- System.out.println("START");
- while (isActive) {
- try {
- Thread.sleep(1000);
- System.out.println("ПКМ");
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- System.out.println("STOP");
- System.out.println();
- }
- @Override
- public void close() {
- isActive = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement