First Java application

Previous
Next

First Java Application:

  • The aim of first application is used to display “Hello world” message on output screen.
  • The application as follows.
class Program 
{
	public static void main(String[] args) 
	{
		System.out.println("Hello World!");
	}
}

class:

  • It is a keyword.
  • It must be in lower case
  • In Java, class represents object
  • Every instruction belongs to class (we cannot write any code outside to class)

Class Name:

  • In the above program, class name is “Program”.
  • Application is a collection of programs.
  • We can access the program using its name only.

main() method:

  • Method is a block of instructions that performs a task.
  • Java application execution starts from main() function.
  • Main() is taking String array as argument(input)
  • Arguments are called Signature of method.

Why main() taking String array as input?

  • Main() method is taking command line arguments as input in the form String array.
  • In C language also, main() function only takes input from command line.

Command line:

  • Command prompt is CUI based Operating System.
    • For example MS-DOS
  • In Computer every program runs by OS.
Previous
Next

Add Comment

Courses Enquiry Form