赞
踩
package com.pzhu.demo; import java.util.Scanner; public class Add { //Java编程实现:写一个方法add,两个整数作为参数,返回这两个整数的和 public static void main(String[] args) { System.out.println("输入两个整数:"); int i = first(); int j = seconde(); int sum = add(i,j); System.out.println(sum); } private static int seconde() { Scanner sc = new Scanner(System.in); int j = sc.nextInt(); return j; } private static int first() { Scanner sc = new Scanner(System.in); int i = sc.nextInt(); return i; } private static int add(int i, int j) { return i+j; } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。