码迷,mamicode.com
首页 > 其他好文 > 详细

关系表达式的使用

时间:2015-08-09 19:06:00      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:关系表达式

利用关系运算符连接的式子成为关系表达式。

关系运算就是比较运算符号(6个:== 、!=、 > 、<、 >=、 <=)


public class C2_8
{    public static void main(String args[])
    {
        boolean x,y;        double a,b;
        a=12.56;
        b=233.23;
        x=(a!=b);
        y=(a==b);
        System.out.println("(a>b)="+(a>b));
        System.out.println("x="+x);
        System.out.println("y="+y);
    }

}

结果

技术分享


本文出自 “桑海田 博客专栏” 博客,请务必保留此出处http://10602803.blog.51cto.com/10592803/1683062

关系表达式的使用

标签:关系表达式

原文地址:http://10602803.blog.51cto.com/10592803/1683062

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!