How to Get Started With Java Programming Just By Looking At.
Table of contents
The first program you write when learning a new programming language is called the Hello World program
When this program runs, it displays the following: Hello, World!
What does each term in the program refers to in simple words focusing on what it does not how it is works.
Java programs are made up of class and methods definitions.
A method is a named sequence of statements
A statement is a line of code that performs a basic action.
In the Hello World
program, this line is a print statement that displays a message to the use:
System.out.println
displays results on the screen.
The name println
stands for print line. Like most statements, the print
statement ends with a semicolon ;
Java is case-sensitive, which means that uppercase and lowercase are not the same.
A method is a named sequence of statements. This program defines one method named main
The name and format of main
is special: when the program runs, it starts at the first statement in main and ends when it finishes the last statement.
This program defines a class named Hello
You can give a class any name you like but it is conventional to start with a capital letter
The name of the class has to match the name of the file it is in, so this class has to be in a file named Hello.java
Java uses curly braces ({ and }) to group things together.
In Hello.java, the outermost braces contain the class definition (represent by red), and the inner braces contain the method definition (represent by green )
The line that begins with two slashes (//
) is a comment
Comments have no effect on the execution of the program, but they make it easier for other programmers (and your future self) to understand what you meant to do.
In next blog I will cover compiling java programs
Please like share my blog
Subscribe to my newsletter
Read articles from Sumit Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Sumit Kumar
Sumit Kumar
Campus Ambassador at Syncloop