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 if else program

Java if else program Java if else program uses if else to execute statement(s) when a condition holds true. Below is a simple program which explains the usage of if else in Java programming language. In this program, a user inputs marks obtained in an exam, and it is compared with the minimum passing marks. An appropriate message is printed on the screen based on whether the user passed the exam or not. Java programming if else statement // If else in Java code import   java.util.Scanner ;   class  IfElse  {    public   static   void  main ( String [ ]  args )   {      int  marksObtained, passingMarks ;         passingMarks  =   40 ;         Scanner input  =   new  Scanner ( System . in ) ;          System . out . println ( "Input marks scored by you" ) ;       ...

Install & Use Gujrati Indic Input Font | સરળ છે ગુજરાતી ઈન્ડિક ઇન્પુટ (શ...

Java program to print multiplication table

Java program to print multiplication table of a number entered by a user using a  for  loop. You can modify it for  while  or  do while  loop for practice. Using nested loops (a loop inside another loop), we can print tables of numbers between a given range say a to b, for example, if the input numbers are '3' and '6' then tables of '3', '4', '5' and '6' will be printed. Java programming source code import   java.util.Scanner ;   class   MultiplicationTable {     public   static   void   main ( String   args [ ] )     {       int   n, c ;       System . out . println ( "Enter an integer to print it's multiplication table" ) ;     Scanner in   =   new   Scanner ( System . in ) ;     n   =   in. nextInt ( ) ;       System . out . println ( "Multiplication table of "   + ...