package com.zhao.demo;
//导入Scanner包
import java.util.Scanner;
public class Demo01 {
/* public static void main(String[] args) {
//键盘输入功能Scanner创建对象
Scanner scanner = new Scanner(System.in);
//接受数据
System.out.println("请输入整数:");
int i = scanner.nextInt();
System.out.println(i);
}*/
}
package com.zhao.test;
//练习部分
//导入Scanner包
import java.util.Scanner;
public class Test1 {
public static void main(String[] args) {
Scanner scanner1 = new Scanner(System.in);
System.out.println("请输入第一个整数:");
int num1 = scanner1.nextInt();
//Scanner scanner2=new Scanner(System.in);
System.out.println("请输入第二个整数:");
//int num2=scanner2.nextInt();
int num2 = scanner1.nextInt();
int num3 = num1 + num2;
System.out.println("两个数的和为:" + num3);
}
}
package com.zhao.test;
import java.util.Scanner;
public class Test2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入第一个整数:");
int num1 = scanner.nextInt();
System.out.println("请输入第二个整数:");
int num2 = scanner.nextInt();
boolean res = num1 == 6 || num2 == 6 || (num1 + num2) % 6 == 0;
System.out.println(res);
}
}
标签:Java,Scanner,num2,int,System,println,录入,out
From: https://www.cnblogs.com/javaHane/p/17139533.html