[SOLVED!] Java Stdin and Stdout I - HackerRank

Опубликовано: 31 Октябрь 2023
на канале: ScottHacksCode
20
0

#coding #interviews #softwareengineering

The solution to HackerRank's Java practive problem #3.

Description: Most HackerRank challenges require you to read input from stdin (standard input) and write output to stdout (standard output).

One popular way to read input from stdin is by using the Scanner class and specifying the Input Stream as System.in. For example:

Scanner scanner = new Scanner(System.in);
String myString = scanner.next();
int myInt = scanner.nextInt();
scanner.close();

System.out.println("myString is: " + myString);
System.out.println("myInt is: " + myInt);

The code above creates a Scanner object named and uses it to read a String and an int. It then closes the Scanner object because there is no more input to read, and prints to stdout using System.out.println(String). So, if our input is: Hi 5, our code will print:

myString is: Hi
myInt is: 5

In this challenge, you must read 3 integers from stdin and then print them to stdout. Each integer must be printed on a new line.

Link to Problem: https://www.hackerrank.com/challenges/java...

SOCIAL
----------------------------------------------------------------------------------------------------------------
Follow me on Facebook: https://www.facebook.com/scott.althaus
Follow me on Instagram: https://www.instagram.com/altyrocks/
Follow me on TikTok: https://www.tiktok.com/@altyrocks1
Follow me on Twitter: https://twitter.com/altyrocks


На этой странице сайта вы можете посмотреть видео онлайн [SOLVED!] Java Stdin and Stdout I - HackerRank длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь ScottHacksCode 31 Октябрь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 20 раз и оно понравилось 0 зрителям. Приятного просмотра!