We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Java Stdin and Stdout II
Java Stdin and Stdout II
Sort by
recency
|
1158 Discussions
|
Please Login in order to post a comment
import java.util.Scanner; public class Solution{ public static void main(String[] args) { Scanner ref = new Scanner(System.in); int a = ref.nextInt();
}
Every input function leaves a newline character and except nextLine(), everyother function will omit that newLine character.
So, to simply solve this issue, we should write another nextLine() before the desired String input we wanted to read
Hackerrank already gave this "note" in the problem itself
Java Code of my
A bit confused at first but now I know. Here's what's happening step by step:
import java.util.Scanner;
public class Solution {
}