Java Day 0 - Hello, World

In this challenge, we review some basic concepts that will get you started with this series. You will need to use the same (or similar) syntax to read input and write output in challenges throughout HackerRank. Check out the Tutorial tab for learning materials and an instructional video!

To complete this challenge, you must save a line of input from stdin to a variable, print Hello, World. on a single line, and finally print the value of your variable on a second line.

You've got this!

  1. import*;
  2. import java.util.*;
  3. import java.text.*;
  4. import java.math.*;
  5. import java.util.regex.*;
  6. public class Solution {
  7. public static void main(String[] args) {
  8. // Create a Scanner object to read input from stdin.
  9. Scanner scan = new Scanner(;
  10. // Read a full line of input from stdin and save it to our variable, inputString.
  11. String inputString = scan.nextLine();
  12. // Close the scanner object, because we've finished reading
  13. // all of the input from stdin needed for this challenge.
  14. scan.close();
  15. // Print a string literal saying "Hello, World." to stdout.
  16. System.out.println("Hello, World.");
  17. // TODO: Write a line of code here that prints the contents of inputString to stdout.
  18. System.out.println(inputString);
  19. }
  20. }