+ 2

How i can make an input and use it?

In Java

23rd Feb 2018, 12:26 PM
kevi
6 Answers
+ 3
You need to import Scanner class: import java.util.Scanner; And create object of Scanner: Scanner scanner = new Scanner(System.in); int a = scanner.nextInt() - for int numbers String b = scanner.nextLine() - for text https://www.sololearn.com/learn/Java/2220/
23rd Feb 2018, 12:34 PM
Pehl Em
+ 2
thanks
23rd Feb 2018, 12:39 PM
kevi
+ 1
Your welcome.
23rd Feb 2018, 12:40 PM
Pehl Em
+ 1
and how i can i make an second Input?
23rd Feb 2018, 1:23 PM
kevi
23rd Feb 2018, 8:07 PM
kevi
0
int first = scanner.nextInt(); int second = scanner.nextInt();
23rd Feb 2018, 1:45 PM
Pehl Em