Instagram
youtube
Facebook
Twitter

"Hello, World!" program with Java HackerRank Solution

Objective

Through this exercise, individuals will learn to set up their development environment, write a simple Java program, understand the syntax required to display "Hello, World!" on the console. This serves as a foundational step in their Java programming journey, enabling them to proceed with more complex challenges and projects on the HackerRank platform.

Input Format

There is no input for this challenge.

Output Format

You must print two lines of output:

  1. Print Hello, World. on the first line.
  2. Print Hello, Java. on the second line.

Sample Output

Hello, World.
Hello, Java.

Solution

public class HelloWorldHR1 {
    public static void main(String[] args) {
        System.out.println("Hello, World.");
        System.out.println("Hello, Java.");
    }
}

Steps used in solving the Problem

1. Create a new Java class "HelloWorldHR1".

2. Within the class, write the main method.

3. Print "Hello, World" using System.out.println().

4. In the next statement, print "Hello, Java." using System.out.println().