Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ThreadDemoWithRunnable {
- public static void main(String[] args) {
- myStart();
- }
- public static void myStart(){
- Thread t = new Thread(new MyThread1());
- Thread t1 = new Thread(new MyThread1());
- // t.run();
- t.start();
- t1.start();
- Thread t2 = new Thread();
- t2.start();
- // t.start();
- }
- }
- class MyThread1 implements Runnable{
- @Override
- public void run() {
- for(int i =0;i<10;i++)
- {
- System.out.println(Thread.currentThread()+" Value "+i);
- }
- }
- }
Add Comment
Please, Sign In to add comment