public class Main {
public static Integer add(Integer a, Integer b) {
int aValue = a.intValue();
int bValue = b.intValue();/**from NowJava.com - 时代Java**/
int resultValue = aValue + bValue;
Integer result = Integer.valueOf(resultValue);
return result;
}
public static void main(String[] args) {
int iValue = 2;
int jValue = 3;
int kValue; /* will hold result as int */
// Box iValue and jValue into Integer objects
Integer i = Integer.valueOf(iValue);
Integer j = Integer.valueOf(jValue);
// Store returned value of the add() method in an Integer object k
/*
时代Java公众号
*/
Integer k = Main.add(i, j);
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。