Skip to content

Instantly share code, notes, and snippets.

@revox
Created January 18, 2015 09:37
Show Gist options
  • Select an option

  • Save revox/18a37381436b57d0d779 to your computer and use it in GitHub Desktop.

Select an option

Save revox/18a37381436b57d0d779 to your computer and use it in GitHub Desktop.
Basic threading example
class threads
{
static class t1 extends Thread
{
public void run()
{
int i=0;
while(true)
{
System.out.println("hello"+i++);
}
}
}
static class t2 extends Thread
{
public void run()
{
int i=0;
while(true)
{
System.out.println("goodbye"+i++);
}
}
}
public static void main( String [] args)
{
new t1().start();
new t2().start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment