CodeGym /Courses /New Java Syntax /Enter a number

Enter a number

New Java Syntax
Level 2 , Lesson 8
Available
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, level 2, lesson 8
Locked
How to take over the world
Enter a name and number from the keyboard, and then display the line: «name» will take over the world in «number» years. Mwa-ha-ha! Example: Kevin will take over the world in 8 years. Mwa-ha-ha! The order in which the data is input matters a lot.
2
Task
New Java Syntax, level 2, lesson 8
Locked
Predictions
Use the keyboard to separately enter the name, number1, and number2. Display the following phrase: «name» will receive «number1» in «number2» years. Here's an example: Nick will receive 10000 in 5 years.
2
Task
New Java Syntax, level 2, lesson 8
Locked
Deep and pure love
Use the keyboard to enter three names, then display: «name1» + «name2» + «name3» = Pure love. Ooo la-la! For example: Kevin + Eva + Angelica = Pure love. Ooo la-la!
Comments (175)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Jimmy Level 25, Lausanne, Switzerland
12 November 2024
stay hard, keep going
Steven Level 3, Augsburg/Munich, Germany
5 November 2024
got bez i deleted the Solution Class and entered my code from the ide, this error q_q Внимательно проверь выводимый текст: похоже, ты забыл пробелы между словами.
Rakesh K Level 3, CodeGym University in India, India
2 September 2024
import java.util.Scanner; guys import this package and use scanner.
theLand Level 6, Tampa, United States
25 August 2024
DO you want us to use Scanner class? Do you not want us to use Scanner class? Can you make your mind up. Thanks
Anonymous #11549069 Level 5, Katowice, Poland Expert
12 August 2024
your complier is wrong . when i put at end , 3th task : " System.out.println(name1 + name2 + name3 " = Pure love. "); " it display :

en/codegym/task/jdk13/task03/task0322/Solution.java:20: error: ')' expected
    System.out.println(name1 + name2 + name3 "  = Pure love.  ");
instead error is missing plus, + sign , not close bracket sign
Anonymous #11549069 Level 5, Katowice, Poland Expert
11 August 2024
you should explain more about BufferedReader (instead of Scanner) in previous lesson if you give now exercise that suggest that it should be used instead of Scanner. Previous movie is about scanner, you explain too little to make it via BufferReader as exercise want it. I see error in previous lesson - you did not explain that number cannot be put as number int type while working with BufferedReader. Also and more important : in previous lesson it was nothing about that it need to import all :

import java.io.BufferedReader;
import java.io.InputStream;  
import java.io.InputStreamReader;
import java.io.Reader; 
so this code will work. and in task there are only two imports already made when open task. You should correct that , either put missing imports in task or exaplain in exercise that they are need.
Luke Level 5, Saint Paul, United States
19 January 2024
You can solve this problem using the Scanner class if you want but at the top near the other 2 already existing Import statements you will need to add the following line of code. import java.util.Scanner; Otherwise the program does not recognize the Scanner class and throws an error.
Papy-La-Taupe Level 3, France
21 November 2023
change the import for : import java.io.BufferedReader; import java.io.InputStream; // Ajout de l'import nécessaire import java.io.InputStreamReader; import java.io.Reader; Or else it can't work
Anonymous #11383577 Level 3, United States of America, United States
18 August 2023
I have to agree, the assignment should reflect what you concentrated on in the lesson. If we are going to use Bufferedreader that us what should be concentrated on ib the lesson.
Anonymous #11274451 Level 3, United States of America, United States
27 June 2023
The details of coding are so annoying!