日期:2014-05-20 浏览次数:20657 次
class TestStuff { public int takeTwo(int x, int y) { //x = 0; y = 3; int z = x > y ? x : y; return z; //System.out.println("Max is " + z); } public static void main(String[] args) { TestStuff t = new TestStuff(); System.out.println(t.takeTwo(12,3)); } }
------解决方案--------------------
public int takeTwo(int x, int y)
{
//x = 0; y = 3;
int z = x > y ? x : y;
return z;
//System.out.println("Max is " + z);
}
System.out.println("Max is " + z); 这句话必须放到return前面去!!