Java Day 0 - Hello, World




Objective
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!

Task
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 java.io.*;
  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(System.in);
  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. }
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]


donate a cup of tea :)


Join Our Facebook Group

Share this solution


download android app

Popular HackerRank Java Solutions








codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube