short age
;
package com
.company
;
import java
.util
.Scanner
;
public class inputData {
public static void main(String
[] args
) {
Scanner scanner1
= new Scanner(System
.in
);
System
.out
.println("请输入您的年龄");
short age
= scanner1
.nextShort();
System
.out
.println("您的年龄是" + age
);
}
}
2.基本用法(这里只做定义变量举例)
例如我要装年龄,年龄一定是整数,所以我选择整型,也许有人活过byte类型的最大值127岁,那么我选择short类型,
转载请注明原文地址:https://ipadbbs.8miu.com/read-52206.html