Advertisement
pastebin46545

simpleDemo - ThreadDemo_Error.java

Sep 28th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. package demo;
  2.  
  3. public class ThreadDemo_Error {
  4.  
  5.     public static void main(String ... a){
  6.  
  7.         System.out.println("main 1");
  8.  
  9.         FakeWindow.doSomeThing();
  10.  
  11.         System.out.println("main 2");
  12.     }
  13.  
  14.     static class FakeWindow {
  15.  
  16.         public static void doSomeThing()
  17.         {
  18.             new Thread(new RunableTemp()).start();
  19.         }
  20.  
  21.     }
  22.  
  23.     static class RunableTemp implements Runnable{
  24.  
  25.         @Override
  26.         public void run() {
  27.             System.out.println("s1");
  28.             try {
  29.                 Thread.sleep(3000);
  30.             } catch (InterruptedException e) {
  31.                 e.printStackTrace();
  32.             }
  33.             System.out.println("s2");
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement