/**
* <p>title: Inheriting thread, implementing threading </p>
* <p>description: Implementing its Run method by inheriting the thread class, implementing its own thread </p>
* <p>copyright:copyright (c) 2003</p>
* <p>Filename:oneThread.java</p>
* @version 1.0
*/
public class Onethread extends Thread {
/**
*<br> Method Description: Constructor, this class does not use
*<br& gt; input parameters:
*<br> return type:
*/
Public onethread () {
}
/**
*<br> method Description: Inherit the method that the thread class must implement. Run this method
*<br> input parameter when calling the Start method:
*<br> return type:
*/
public void Run () {
System.out.println (" ... onethread begining ...................... ...
int flag = 0;
while (true) {
if (flag==20) {
System.out.println ("\n...............onethread" ...). ");
break;
}
for (int i=0;i<flag;i++)
System.out.print ("*");
System.out.println ("");
flag++;
try{
//sleep 0.1 seconds
Sleeping (MB);
}catch (Exception e) {
}
}
/**
*<br> Method Description: Main method. Start this thread
*<br> input parameters:
*<br> return type:
*/
public static void Main (String args[]) {
New Onethread () . Start ();
}
}