【发布时间】:2014-12-29 10:37:18
【问题描述】:
在这个简单的程序中我不能返回 2 个整数值,你能帮帮我吗? 我能怎么做 ?
public class Aritmetica
{
public static int div(int x , int y)
{
int q = 0 ;
int r = x ;
while ( r >= y )
{
r = r - y ;
q = q + 1 ;
}
return r && q; **// Here i want to return x and y**
}
public static void main(String[ ] args)
{
if ( ( x <=0 ) & ( y > 0 ) )
throw new IllegalArgumentException ( " X & Y must be >0 " ) ;
int res4= div(x,y);
System.out.println( " q and r : "+ res4) ; **// and here i want to display q and r**
}
}
【问题讨论】: