public static int add(int a,int b){
return a+b;
}
public static int abs(int i){
if (i>=0)
return i;
else return -i;
}
}
public static void main(String args[]){
int a=abs(-4);
int b=abs(5);
System.out.println(add(a,b));
}
return a+b;
}
public static int abs(int i){
if (i>=0)
return i;
else return -i;
}
}
public static void main(String args[]){
int a=abs(-4);
int b=abs(5);
System.out.println(add(a,b));
}
{ if((x>=0)&&(y>=0))
return x+y;
else if(x>0)
return x-y;
else if(y>0)
ret;urn y-x;
else return -y-x;
}
public class value {
int i,j;
int value(int i1,int j1){
if (i1<0) i=-i1;
else i=i1;
if (j1<0) j=-j1;
else j=j1;
return(i+j);
}
public static void main(String[] arguments){
value rect =new value();
int x;
x=rect.value( 4,-66);
System.out.print(x);
}
{
i=i>0?i:-i;
j=j>0?j:-j;
return(i+j);
}
import java.io.*;
class aaa
{
public static void main(String args[]) throws Exception
{
byte array1[]=new byte[10] , array2[]=new byte[10];
Integer theFirst,theSecond;
String tempOne,tempTwo;
int a,b,lengthOfArray=0;
System.out.print("请输入第一个数:");
lengthOfArray=System.in.read( array1);
tempOne= new String(array1,0,lengthOfArray-2);
theFirst=new Integer(tempOne);
System.out.print("请输入第二个数:");
System.in.read(array2,0,array2.length);
tempTwo= new String(array2,0,lengthOfArray-2);
theSecond=new Integer(tempTwo); a=theFirst.intValue();
b=theSecond.intValue();
System.out.println(absAdd(a,b));
}
private static int absAdd(int x,int y)
{ if((x>=0)&&(y>=0))
return x+y;
else if(x>0)
return x-y;
else if(y>0)
return y-x;
else return -y-x;
}
}