OBJECT ORIENTED PROGRAMMING WITH JAVA by Ladwa Hanumanth

OBJECT ORIENTED PROGRAMMING WITH JAVA by Ladwa Hanumanth

Author:Ladwa, Hanumanth [Ladwa, Hanumanth]
Language: eng
Format: epub
Published: 2021-08-03T16:00:00+00:00


F:\java programs>java ThreadTest

Hello 0

Hello 1

Hello 2

Hello 3

Hello 4

// Write a program to demonstrate implementation of a thread

class myThread implements Runnable

{

public void run()

{

for(int i=5;i>0;--i)

System.out.println("Child Thread: "+i);

System.out.println("Exiting child thread");

}

}

class Demo

{

public static void main(String args[])

{

myThread r=new myThread();

Thread t=new Thread(r);

t.start();

for(int i=5;i>0;--i)

System.out.println("Main thread: "+i);

System.out.println("Exiting main thread");

}

}

Output:

F:\java programs>javac Demo.java



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.