0
Does anyone tell me what is the data type of the variable that are going to assigned to user input scanner variable
2 Antworten
+ 5
Hello Abdullah Shahzad
Scanner scan = new Scanner(System.in);
integer:
scan.nextInt();
double:
scan.nextDouble();
String:
scan.next() for one word or scan.nextLine() takes the whole string with spaces
You can do this with a lot of data types: nextFloat() or nextBigInteger() and so on.
+ 1
Thanks