Enter a number

Open
Enter a number - 1

"Hi, Amigo. You're doing great. Here is a new exercise for you: write a program that accepts some data from the keyboard and displays text that uses that data:"

2
Task
New Java Syntax,  2 level,  8 lecture
Locked
How to take over the world
How to take over the world
2
Task
New Java Syntax,  2 level,  8 lecture
Locked
Predictions
Predictions
2
Task
New Java Syntax,  2 level,  8 lecture
Locked
Deep and pure love
Deep and pure love
Комментарии (14)
  • популярные
  • новые
  • старые
Для того, чтобы оставить комментарий Вы должны sign in
danshy1803 Java Developer
23 March 2024, 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
danshy1803 Java Developer
23 March 2024, 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!"); } }
Vladyslav Boiko
Уровень 3
17 June 2024, 19:13
why wasn't the first one working?
danshy1803 Java Developer
29 June 2024, 18:47
Scanner wasn't imported
Anonymous #3045483
Уровень 7
6 October 2024, 10:54
you dont even need to parse int from the input text because there is no need in representation of it as a number. System.out.println wants a string, and you can leave it a String, without making unnecessary transformations ;)
YaharpY
Уровень 14
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
Anonymous #3315988
Уровень 3
14 June 2023, 20:37
bruh
Kirill
Уровень 3
4 October 2022, 09:15
Did you suddenly forgot that you were teaching people and not just talking to yourself?
Sergey
Уровень 23
9 September 2022, 10:17
Why in the first excercise work ONLY second example from the previous lesson?
Gerasim
Уровень 2
31 August 2022, 12:32
Not enough information given in the previous lesson for completing the task! Amigo isn’t happy!
nomadcoder Java Developer
10 June 2022, 01:34
Can you add explanation what does "throws Exception" means and why did we add it here?
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?
Andrei Nico
Уровень 5
3 December 2021, 09:59
I don't understand what does the 'BufferedReader' and 'InputStreamReader' and why should we use them together...
REM Backend Developer
13 December 2021, 19:53
This is a difficult topic. It's like learning English: you just have to remember first.