java小编程~~帮帮忙~~!

来源:百度知道 编辑:UC知道 时间:2024/06/28 17:15:34
设int x=4,y=5,z=6,boolean=true
计算下面逻辑表达式
x+y>z&&y==z
fIIy+z<x&&y>y
!(x+y)&&f
不好意思,我说错了,我是想让大家按上边要求帮我编写一个程序~~谢谢~~~

public class Test{

public static void main(String[] args){
int x=4,y=5,z=6;
boolean f =true ;

System.out.println(x+y>z&&y==z);
System.out.println(f||y+z<x&&y>y);
System.out.println(!(x+y)&&f);//不能对自变量int定义运算符!
}
}

false
true
最后一个不合法 ---> !(x+y)