摘要: 一、标准的输入/输出 System.out 表示标准的输出设备:使用println方法显示基本值或字符串。 System.in 表示标准的输入设备:Java不直接支持控制台输入。 二、创建Scanner类的对象、以来读取来自System.in的输入 三、Scanner对象的方法 方法 描述 四、实例 阅读全文
posted @ 2020-12-03 22:02 不如川 阅读(28) 评论(0) 推荐(0)
摘要: public class ShiXun01 { public static void main(String[] args) { System.out.println("1~100所有偶数的和为:"); for(int i=0;i<=100;i++){ if(i%2==0) { System.out 阅读全文
posted @ 2020-12-03 21:31 不如川 阅读(661) 评论(0) 推荐(0)
摘要: import java.util.Scanner; public class ShiXun01 { public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("请输 阅读全文
posted @ 2020-12-03 21:30 不如川 阅读(422) 评论(0) 推荐(0)
摘要: 控制台输入一个整数,判断该数字是否为偶数 import java.util.Scanner; public class ShiXun01 { public static void main(String[] args) { int a; System.out.println("请输入a的值:"); 阅读全文
posted @ 2020-12-03 21:29 不如川 阅读(767) 评论(0) 推荐(0)