0

How to collect multiple inputs from user im Java?

example am going to calculate 2 numbers from user

18th Sep 2019, 9:12 AM
Sakthi Chandru
Sakthi Chandru - avatar
2 odpowiedzi
+ 1
If you use Scanner from java.util.Scanner Example Scanner sc = new Scanner(System.in); System.out.print("Please enter first number: "); int firstNumber = sc.nextInt(); System.out.print("Please enter second number: "); int secondNumber = sc.nextInt(); System.out.println("Sum = " + (firstNumber + secondNumber));
18th Sep 2019, 9:34 AM
Phurinat Puekkham
Phurinat Puekkham - avatar
0
Thank you
18th Sep 2019, 9:36 AM
Sakthi Chandru
Sakthi Chandru - avatar