Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Hello World Program
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Suprith
Hello World Program
3 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


write a java program that continuously prints HelloWorld! to the screen(once every second ) and exists when press the enter key


Advertisement
View Answers

December 20, 2010 at 5:39 PM


Hi Friend,

Try the following code:

public class DisplayMessageContinuously extends Thread {
  private String st;          
  private long delay;              

  public DisplayMessageContinuously(String st, long delay) {
    this.st = st;      
    this.delay = delay;                  
    setDaemon(true);                 
  }

  public static void main(String[] args) {
    Thread th = new DisplayMessageContinuously("Hello World ", 1000);
    th.start();                      
    try {
      System.in.read();                
      System.out.println("Enter pressed...\n");

    } catch (Exception e) {          
      System.out.println(e);            
    }
    return;
  }
  public void run() {
    try {
      while(true) {                         
        System.out.println(st);         
        sleep(delay);                       
       }
    } catch(Exception e) {       
      System.out.println(e);    
    }
  }
}

Thanks



December 20, 2010 at 7:58 PM


Thanks



December 20, 2010 at 7:58 PM


Thanks



Related Tutorials/Questions & Answers:
Hello world program
Hello world program  hello world program   class Hello{ public static void main(String[] args) { System.out.println("Hello World"); } } For more information, visit the following link: http
Hello World Program
Hello World Program  write a java program that continuously prints HelloWorld! to the screen(once every second ) and exists when press the enter key... = new DisplayMessageContinuously("Hello World ", 1000); th.start
Advertisements
Smarty Hello World Program
How to write "Hello World" program? In any smarty program we need...;//enable the caching   $smarty->assign ('name', 'hello world...;/html>   To run your first program: i) Start WAMP server ii) Type http
Hello world (First java program)
Hello world (First java program)   ... independent and can be run on any operating System. Writing Hello World program is very simple. To write the Hello world program you need  simple text editor like
Hello world
Hello world (First java program)   ... and can be run on any operating System. Writing Hello World program is very simple. To write the Hello world program you need  simple text editor like note
Very simple `Hello world' java program that prints HelloWorld
Hello World Java Simple Java Program for beginners... to develop robust applications. Writing a simple Hello World program is stepwise... HelloWorld.java - the source code for the "Hello, world!" program
Hello World - Java Beginners
Hello World  Java Beginner - 1st day. Looked at the Hello World......){ System.out.println("Hello World!"); } } what am I doing wrong. Am I expecting too   Hi friend,i saw your program. your program is correct, i think
JavaScript Hello World
Hello World Program in JavaScript To write and run a JavaScript program all we...("Hello World"); </script> </head> <body> </body> </html>   Output: Hello World
Hello World in servlet
Hello World in servlet  Hello World example in servlet ?   ..., IOException { PrintWriter out = res.getWriter(); out.println("Hello World!"); out.close
Objective C Hello World
("Hello, World!"); return ; } Save this program... Objective C Hello World     ... World program. In the next section I will show you how to compile and execute
Struts 2 Hello World Example
Struts 2 Hello World Example - Video Tutorial that shows how to create Hello World example program in Eclipse IDE. In this video tutorial I will teach you how to develop 'Hello World' application in Struts 2 framework. We
J2ME Hello World Example
J2ME Hello World Example       This is the simple hello world application. In this example we...;Hello World!!!!!!!" as below:  Form form = new Form("
EJB Hello world example
EJB Hello world example      ... example we are going to show you, how to create your first hello world example in EJB and testing it. You can also create a hello world example to test your
pring Hello World Application
Spring Hello World Application       Hello World Example using Spring, The tutorial given below describes you the way to make a spring web application that displays Hello World
Android Studio Hello World Tutorial
Studio. So, this is how you can create your own hello world program in Android...Android Studio Hello World Tutorial - Learn application development using Android Studio IDE Video tutorial on developing Hello World Example using Android
Java Hello World code example
Java Hello World code example  Hi, Here is my code of Hello World program in Java: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World
Servlet hello world example
by making Servlet hello world program. We will just write one program which print hello world in Servlet. Let us explain this by a hello world example using Servlet...Servlet  hello world example This tutorial will help you to understand
jQuery to "Hello World"
the Hello World  program Step 1: Create php file to that prints the current...;? print $hello_world="Hello World"; ?> Step 2: Write HTML page to call... jQuery to "Hello World"     
iPhone Hello World in Objective C
iPhone Hello World in Objective C This is a very simple objective c hello world program example, in which you will learn how to make your first hello world... it will return " Hello, World!" To see the output choose "run->Console" from
Hello world (First java program)
Hello world (First java program)   ... and can be run on any operating System. Writing Hello World program is very simple. To write the Hello world program you need  simple text editor like note
Writing Hello World
Writing Servlet Hello World      .... Lets start by making one program which will just print the "Hello...;Hello World" to the user. As we know that the our servlet extends
JSP Hello World
JSP Hello World We are going to discus about JSP hello world. In this example we are create "HelloWold" on web browser. In this program of JSP instances. we can print simple "Hello World" String on web browser
Understanding Hello World Java Program
Understanding Hello World Java Program   ...[] args) {    System.out.println("Hello, World...("Hello, World"); prints the "Hello World" on the console
jQuery Hello World
jQuery Hello World example     ... application called "Hello World jQuery". This application will simply display...'s start developing the Hello World application in jQuery. Video Tutorial
TIBCO Designer Tutorial - Hello World
you how to create a process definition that writes the words "Hello, World... output "Hello, World!" into the file. This task requires knowledge of the file... and text content of "Hello, World!" into the activity configuration. Then you're
Hello World JSP Page
and the contents. Following code of the program prints the string "Hello World!"... Hello World JSP Page      ... of JSP illustrates you how to print simple "Hello World!" string
Simple Procedure to display Hello World
Simple Procedure to display Hello World   ... that helps you to display 'Hello World'. In this Example, we create a procedure... you the 'Hello,World' ,whenever a procedure 'abc' is invoked. Create
Spring Hello World prog - Spring
Spring Hello World prog  I used running the helloworld prog code mentioned in http://www.vaannila.com/spring/spring-mvc-tutorial-1.html I'm getting null pointer exception. as shown below. I added all the jars and my
Php gd hello world
/Fonts/arial.ttf'; $string = 'Hello World!'; imagettftext ($image, 30, 0, 10...); ?> After running the program you will get the following output
Hello world pdf
hello world pdf       In this program we are going to tell you how you can write a simple "Hello World" word in a pdf, rtf and html file irrespective of the fact
JSF Hello World
JSF Hello World      ... to print hello world in JSF application using NetBeans IDE. NetBeans IDE provides... classes etc. Steps to create JSF Hello World Example: 1. Go to your project
 

 

 

DMCA.com