Hello World 1
This is a program to learn console output with and without newline.
Learning Objectives
To learn java concepts related to :
- Difference between print() and println() method for showing the output to console.
Program Approach
The objective is to demonstrate console output using multiple print or println methods.
Since we want that the second output should come adjacent to the first one we will use theprint() method in the first statement but in the second statement we will use println() as we want the other outputs to be displayed in the next line.
Source Code
|
|
Run Output
Code Understanding
System.out.print(βHello β);
In this statement we have not used println() method, instead we have used print() as we want the next output to be displayed in the same line.
System.out.println(βWorld!β);
In this statement we have used the method println() as we want the other outputs to be displayed in the next line.
Suggested Filename(s): HelloWorld1.java
Created: 13-Aug-2016 13:13 | Updated: 16-Jun-2026 18:52|
