• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads

 
Vihanga Rajalingam
Greenhorn
Posts: 3
Android Java Mac PPC
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Demo{
public static void main(String args[]){
MyRunnable r=new MyRunnable();
//r.start();
Thread t1=new Thread(r);
t1.start();
for(int i=0;i<100;i++){
System.out.println("main thread "+i);
}
}
}

class MyRunnable implements Runnable{
public void run(){
for(int i=0;i<100;i++){
System.out.println("My thread "+i);
}
}
}


What is the explanation of this program?
 
Henry Wong
author
Marshal
Pie
Posts: 21016
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vihanga Rajalingam wrote:


What is the explanation of this program?



Looks like a pretty straightforward example. Can you tell us what do you think is going to happen? Have you run it? And what are you confused about?

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic