Hello World!
In this lesson, you will get acquainted with the Hello World program and a basic introduction to Java.
Hello World: Example #
The first program that most aspiring programmers write is the classic “Hello World” program. The purpose of this program is to display the text “Hello World!” to the user.
The “Hello World” example is somewhat famous as it is often the first program presented when introducing a programming language.
Try running the code below!
class HelloWorld {public static void main(String args[]) {System.out.println("Hello World!");}}
Did you know? The
System.out.println()
displays text in the current line of the console and then move the cursor to the beginning of the next line.
Java
as a structural language
Before discussing the particulars, it is useful to think of a computer program in terms of both its structure and its meaning simultaneously.
A Java
program is structured in a specific and particular manner. Java
is a language and therefore has grammar similar to a spoken language like ...