输入两个整数,求两数之和

package ceshi;

import java.io.*;
public class LiangShuHe
{
    public static void main(String args[])throws IOException
    {
        int num1,num2;
        String str1 ;
        BufferedReader buf;
  buf = new BufferedReader(new InputStreamReader(System.in));
  System.out.print("请输入第一个数:");
  str1 = buf.readLine();
  System.out.print("");
  num1 = Integer.parseInt(str1);
  String str2 = buf.readLine();

  num2 = Integer.parseInt(str2);
  System.out.println(num1 + " + " + num2 + "=" + (num1 + num2));
    }
}

你可能感兴趣的:(java)