初学者的question

[复制链接]
查看11 | 回复2 | 2009-6-30 08:59:59 | 显示全部楼层 |阅读模式
int x=3,y=4,max;
max=(x>y)?x:y;
answer: max=x;
不是吧,应是等于y。不知对不对
回复

使用道具 举报

千问 | 2009-6-30 08:59:59 | 显示全部楼层
你的基本语法没掌握好,看看Java2详解
回复

使用道具 举报

千问 | 2009-6-30 08:59:59 | 显示全部楼层
没有实践 ,就没有发言权.
public class A {

public static void main(String args[]) {

int x = 3, y = 4, max;

max = (x > y) ? x : y;

System.out.println(max);

}
}
调试结果
args= java.lang.String[0](id=12)
x= 3
y= 4
max= 4
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行