LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 858|回复: 2

not a statement

[复制链接]
发表于 2005-10-4 10:05:02 | 显示全部楼层 |阅读模式
class helloworld{
public static void main(String args[])
{
int i=10;
int j=10;
int x=0;
boolean Test=false;
System.out.println("i"+"\t"+"j");

x>0?  x : -x;
//Test?(i=1)j=1);
System.out.println(i+"\t"+j);
Test=true;

//Test?(i=0)j=0);
System.out.println(i+"\t"+j);
}
               }


编译不通过。。

helloworld.java:12: not a statement
x>0?  x : -x;
   ^
1 error
发表于 2005-10-4 19:47:04 | 显示全部楼层
x>0? x : -x;  应该返回值
回复 支持 反对

使用道具 举报

发表于 2005-10-6 11:13:57 | 显示全部楼层
y = x>0? x : -x;
回复 支持 反对

使用道具 举报

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

本版积分规则

快速回复 返回顶部 返回列表