+ 1

How to get two inputs ?

how to get two inputs? and how to close the variables of those input?

7th Dec 2016, 11:52 AM
Devakarthik
Devakarthik - avatar
1 Odpowiedź
+ 5
Well, you can use this code import java.util.*; public class Program { public static void main(String[] args) { int ints; String str; Scanner s = new Scanner(System.in); System.out.println("Please enter age and money by separating them with space."); String userInputs[] = s.nextLine().split(" "); ints = new Integer(userInputs[0]); str = new String(userInputs[1]); System.out.println("You have entered \n Integer:- " + ints + "\n String:- " + str); s.close(); } }
7th Dec 2016, 11:55 AM
Aditya kumar pandey
Aditya kumar pandey - avatar