描述的思路:
1.导的包(java.util)下的包
2.程序的主入口main方法
3.键盘录入,通过这个可以往虚拟机中输入参数(数字,字母,符号等等)
4.死循环,让程序一直跑(除非手动关掉)
5.键盘录入,录入的数会显示到控制台
6.系统输出 第一个参数对象 拼接的+号 第二个参数 拼接的等于号 (第一个参数+第二个参数)
package com.shenyang.huangrui;
import java.util.Scanner;
public class Demo01 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while(true) {
System.out.println("请输入第一个参数");
int first = Integer.parseInt(input.next());
System.out.println("再次输入第二个参数");
int second = Integer.parseInt(input.next());
System.out.println(first+"+"+second+"="+(first+second));
System.out.println(first+"-"+second+"="+(first-second));
System.out.println(first+"*"+second+"="+first*second);
System.out.println(first+"/"+second+"="+first/second); } }
}
浙公网安备 33010602011771号