Skip to main content

Time Out Program in java

import java.io.*;
import java.lang.*;
class t extends Thread
{
public void run()
{
try
{

Thread.sleep(10000);

System.out.println("System has timed out");
System.exit(0);
}
catch(Exception e)
{
}

}
}
class th
{
public static void main(String args[])throws Exception
{
DataInputStream d=new DataInputStream(System.in);

t ob = new t();
String a,b;
System.out.println("Enter username");
a=d.readLine();

ob.start();
System.out.println("Enter password");
b=d.readLine();
ob.stop();
System.out.println("You have logged in");


}
}

Comments

Popular posts from this blog

unix commands