COMP2243 - Programming and Problem Solving

Syllabus Software Installation Assignments Tests
Lectures and Labs
**Back to Full Menu**

Fundamentals HelloWorld.java Basics.java Payroll.java Cartons.java Time.java DollarAmount.java StringPractice.java PayrollGUI.java



Hello World Program


Description

HelloWorld is usually the first program people write to learn a new programming language such as Java.

The purpose of the program is to demonstrate the basic syntax of Java and how to use an IDE to write, compile, and run the program.

The program simply prints a few messages on the computer's output device: monitor.

The program file, HelloWorld.java, is called source code.

After compiling the source code successfully, the byte-code file HelloWorld.class is generated, it is the executable file.



Associated Concepts:

IDE

Programming process: write, compile, and run

Output device, System.out.println(), and System.out.print() methods

Escape sequences

Algorithm:

Use System.out.println() method to print a message followed by a new line character

Use escape sequence "\n" to add a new line

Use System.out.print() method to print a message without a new line character afterwards

Source Code



Sample Run




Video