17 lines
391 B
Java
17 lines
391 B
Java
public class ThreadExample1 extends Thread
|
|
{
|
|
public void run()
|
|
{
|
|
int a = 22;
|
|
int b = 26;
|
|
int result = a+b;
|
|
System.out.println("Thread started running..");
|
|
System.out.println("Sum of two numbers is: " +result);
|
|
}
|
|
public static void main(String[] args)
|
|
{
|
|
ThreadExample1 t1 = new ThreadExample1();
|
|
t1.start();
|
|
}
|
|
}
|