Back

两道题

|

1.下面是一个java代码片段, 现传值-7进入这个方法, 结果是神马??请勿使用编译器.
```` ```
public static boolean m7(int arg)
{
int result;
if (Math.abs(arg) == arg)
{
return true;
}
else
{
return(((m7(arg)))&&(m7(-arg)))
}
}
``` ````
2.
```` ```
public class Q8
{
private int x = 1;
public Q8(int a)
{
x = m8(a);
}
public int m8(int a)
{
if(a == 0)
{
return x;
}
else
{
return(2*m8(a-1));
}
}
}
``` ````
根据上面的代码片段, 假设在main()方法中有:
`Q8 test = new Q8(4);`
则请问test.x为他妈的何值? 同样的请勿使用编译器.

No comments yet

Leave a comment

About me

I live in Tasmania, an island a little far from the rest of the world and very close to the sea.
Father of two little girls, have two puppies.

Work

Work in IT industry, AI is my working partner.