编程语言
首页 > 编程语言> > JavaDay01.练习1.键盘输入两个int数字,并且求出和值

JavaDay01.练习1.键盘输入两个int数字,并且求出和值

作者:互联网

JavaDay01.练习1.键盘输入两个int数字,并且求出和值

import java.util.Scanner;

/**
 * 练习1 题目:
 * 键盘输入两个int数字,并且求出和值
 */
public class T1 {
    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();
        int result = num1 + num2;
        System.out.println(num1 + " + " + num2 + " = " + result);
    }
}

标签:scanner,num2,int,System,键盘输入,Scanner,JavaDay01,num1
来源: https://blog.csdn.net/weixin_44700358/article/details/120606176