Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 com.mycompany.app21;
- import java.time.LocalTime;
- /**
- *
- * @author Admin
- */
- public class MyLongTask implements Runnable {
- public MyLongTask(){
- }
- @Override
- public void run() {
- //
- System.out.println("MyLongTask.run>>");
- System.out.println("BEFORE SLEEP..." + LocalTime.now());
- try {
- // используем метод sleep - 2000 - приостанавливаем выполнение на 2с
- Thread.sleep(2000);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- System.out.println("AFTER SLEEP...");
- System.out.println("AFTER SLEEP..." + LocalTime.now());
- System.out.println("<<");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement