求助:java程序编译提示:错误:需要<标识符>
public class Test{
int x=-10 ,y=0 ;
y=x>=0?x:-x;
public static void main(String[]args)
{
System.out.println("the abs of "+x+" is "+y);
}
}
总提示:Test.java:4 错误: 需要<标识符>
y=x>=0?x:-x;
^
改为下面的代码则不会出错。为什么?
public class Test{
public static void main(String[]args)
{
int x=-10 ,y=0 ;
y=x>=0?x:-x;
System.out.println("the abs of "+x+" is "+y);
}
}
谢谢! ^