+ 1

Why the input commands don't work?

I just can't run my program and That's because I don't know how to write the Input commands here. I wrote "reader.nextInt();" But it didn't work.. https://code.sololearn.com/ck4Wqhdu1Ypm/?ref=app

8th Jan 2020, 7:48 PM
Israel Cohen
Israel Cohen - avatar
3 Respostas
+ 3
here it is import java.util.*; public class Program { public static void main(String[] args) { int Num, Max; /* Hello, please follow the commands bellow~ */ Scanner reader = new Scanner(System.in); Num=reader.nextInt(); Max = reader.nextInt(); if(Num>Max) Max=Num; else Max=Max; } }
8th Jan 2020, 7:55 PM
Abdol Hashimi
Abdol Hashimi - avatar
+ 2
You haven't imported and instantiated Scanner Class
8th Jan 2020, 7:55 PM
Abdol Hashimi
Abdol Hashimi - avatar
+ 1
Oh, thank you a lot. I guess I used to write it without the System in command cause when we learn at school we write codes in our Notebooks. Thank you for fixing my Program!
8th Jan 2020, 7:59 PM
Israel Cohen
Israel Cohen - avatar