-
-
Save rsandhusdg/196b4e85a274a236c22f8c2920ada4a8 to your computer and use it in GitHub Desktop.
HackerRank- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Day 0: Hello, World*/ | |
| /*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.*/ | |
| /*https://www.hackerrank.com/challenges/30-hello-world*/ | |
| /*The problem statement has been taken from HackerRank.Credits to HackerRank and the problem setter. | |
| I do not claim any copy right or warranty. | |
| */ | |
| import java.io.*; | |
| import java.util.*; | |
| import java.text.*; | |
| import java.math.*; | |
| import java.util.regex.*; | |
| public class DayZero { | |
| public static void main(String[] args) { | |
| // Create a Scanner object to read input from stdin. | |
| Scanner scan = new Scanner(System.in); | |
| // Read a full line of input from stdin and save it to our variable, inputString. | |
| String inputString = scan.nextLine(); | |
| // Close the scanner object, because we've finished reading | |
| // all of the input from stdin needed for this challenge. | |
| scan.close(); | |
| // Print a string literal saying "Hello, World." to stdout. | |
| System.out.println("Hello, World."); | |
| // TODO: Write a line of code here that prints the contents of inputString to stdout. | |
| System.out.println(inputString ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment