Scanner scanner = new Scanner(System.in);
String name = scanner.nextLine();
int age = scanner.nextInt();
System.out.println(name + " will conquer the world in " + age + " years. Mwa-ha-ha!");
The displayed text must fully match the task conditions.
RECOMMENDATION FROM YOUR MENTOR
Be sure that you haven't mixed up the order of reading in the name and number from the keyboard. Check the conditions.hidden #10366080
Level 5
its not clearing the last condition
Resolved
Comments (13)
- Popular
- New
- Old
You must be signed in to leave a comment
hidden #10366080
2 November 2018, 12:09
0
Roman
2 November 2018, 11:38
Be sure that you haven't mixed up the order of reading in the name and number from the keyboard. Check the conditions.
0
hidden #10366080
2 November 2018, 11:56
i did not. it last condition keep missing.
0
hidden #10366080
2 November 2018, 11:58
look at my code and tell e if i'm doing anything wrong
0
hidden #10366080
2 November 2018, 12:01
0
Roman
2 November 2018, 12:20
Be sure that you haven't mixed up the order of reading in the name and number from the keyboard ))
0
hidden #10366080
2 November 2018, 12:46
not helpful, but i figured it out
0
kapil
1 November 2018, 09:15
in third line use name instead scanner
0
hidden #10366080
2 November 2018, 12:00
what? as in
int age = name?
0
kapil
2 November 2018, 12:19
ok fine
use this one
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int age = Integer.parseInt(reader.readLine());
and dont forget to include
import java.io.*;
and throws IOException in main method
0
hidden #10366080
2 November 2018, 12:45
i figured it out, thanks though!
0
Khurram
1 November 2018, 08:49
try using the BufferedReader for taking inputs instead of Scanner
0
hidden #10366080
2 November 2018, 11:59
i tried everything
0