package com.codegym.task.task03.task0318;
/*
Plan to conquer the world
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String name = reader.readLine();
String year = reader.readLine();
int nYear = Integer.parseInt(year);
System.out.println(name + " will take over the world in " + nYear + " years. Mwa-ha-ha!");
}
}
What's wrong with my code .. ? It says: "Be sure that you haven't mixed up the order of reading in the name and number from the keyboard. Check the conditions."
Under discussion
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
hidden #10444738
1 May 2019, 08:24
Because the first entry gets moved to the right when a second entry gets input. then the whole thing is read from left to right.
0
Ferdinando Grande
29 April 2019, 06:10useful
Hi, Because in the task conditions it is written "Enter the number and name from the keyboard". So the first input is the number of years and the second is the name. Remember that the input is read in the order you enter it from the keyboard.
+6
Alex
28 April 2019, 15:30
I figured it out. First age and then the name. Why !?
0