變數類型 | 指令 | |
類型 | 變數 | |
整數 | byte | byte input = sc.nextByte(); |
short | short input = sc.nextShort(); | |
int | int input = sc.nextInt(); | |
long | long input = sc.nextLong(); | |
浮點數 | float | float input = sc.nextFloat(); |
double | double input = sc.nextDouble(); | |
字串 | String | String input = sc.next(); |