Skip to main content

Java hello world program

Hello world Java program: Java code to print hello world.


Java programming source code

class HelloWorld
{
   public static void main(String args[])
   {
      System.out.println("Hello World");
   }
}

Download Hello world program class file.

"Hello World" is passed as an argument to println method, you can print whatever you want. There is also a print method which doesn't take the cursor to the beginning of next line as println does. System is a class, out is an object of PrintStream class, and println is the method.

Output of program:




Comments

Popular posts from this blog

Java while loop

Java while loop Java while loop is used to execute statement(s) until a condition is true. In this tutorial, we will learn to use while loop with examples. First of all, let's discuss while loop syntax: while (condition(s)) { // Body of loop } 1. If the condition(s) holds true then the body of the loop is executed, after execution of the loop body condition is tested again and if the condition is still true then the body of the loop is executed again, and the process repeats until the condition(s) becomes false. The condition evaluates to true or false and if it is a constant, for example, while (c) {…}, where c is a constant, then any non zero value of c is considered to be true, and zero is considered false. 2. You can test multiple conditions such as while   ( a  >  b  &&  c  !=   0 )   {   // Loop body } Loop body is executed till value of variable a is greater than value of...

Chromecast unboxing