Enter a number
Comments (11)
- Popular
- New
- Old
You must be signed in to leave a comment
danshy1803 Java Developer
23 March, 09:05
Scanner scanner = new Scanner(System.in);
String name = scanner.nextLine();
int number = scanner.nextInt();
System.out.println(name + " will take over the world in " + number + " years. Mwa-ha-ha!");
Doesn't work and I don't know why
0
danshy1803 Java Developer
23 March, 09:09
Nvm, figured that out, here's the code for everyone strugglin:
package en.javarush.task.jdk13.task03.task0318;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
How to take over the world
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String name = reader.readLine();
String sNumber = reader.readLine();
int number = Integer.parseInt(sNumber);
System.out.println(name + " will take over the world in " + number + " years. Mwa-ha-ha!");
}
}
0
YaharpY
25 September 2023, 19:06
well, the first task is definitely not for level 2... It was a poor explanation in the lesson, so there is close to no chance of completing the task without additional research
0
Anonymous #3315988
14 June 2023, 20:37
bruh
+3
Kirill
4 October 2022, 09:15
Did you suddenly forgot that you were teaching people and not just talking to yourself?
+10
Sergey
9 September 2022, 10:17
Why in the first excercise work ONLY second example from the previous lesson?
0
Gerasim
31 August 2022, 12:32
Not enough information given in the previous lesson for completing the task! Amigo isn’t happy!
+3
nomadcoder Java Developer
10 June 2022, 01:34
Can you add explanation what does "throws Exception" means and why did we add it here?
+5
G QA Automation Engineer Expert
8 April 2022, 16:39
Why my text which exactly equal to hint's text do not pass the task condition?
+2
Andrei Nico
3 December 2021, 09:59
I don't understand what does the 'BufferedReader' and 'InputStreamReader' and why should we use them together...
+8
REM Backend Developer
13 December 2021, 19:53
This is a difficult topic. It's like learning English: you just have to remember first.
+2