Get Some Free Products at your Door Step. Just feed ur Address in dis Link...!!

Showing posts with label Simple Use of Extended Thread. Show all posts
Showing posts with label Simple Use of Extended Thread. Show all posts

Saturday, October 8, 2011

Simple Use of Extended Thread

import javax.swing.JOptionPane;
public class Xtendedthread extends Thread
{

static public void main(String ar[])
{
Xtendedthread x = new Xtendedthread();
int i = Integer.parseInt(JOptionPane.showInputDialog("Enter which table you want:\n1. 19 \n2. 24 \n 3. 17"));
switch(i)
{
case 1: x.nineteen();JOptionPane.showMessageDialog(null,"Main thread waiting for child thread..!!");break;
}
}
public void nineteen()
{
start();
}
public void run()
{
String table=" ";
for(int i=1;i<11;i++)
{
table =table+ "\n"+ 19*i;
}
JOptionPane.showMessageDialog(null,"Child thread giving result" +table);
}
}