Java Relational Operators / Chapter -4 /Operator & Assignments



relational operators


java relational operators


1.These are the relational operators in java.


                          < ,<=,>,>=


2.These operators can be used for every primitive data type. But we can't apply these operators for boolean type.


example:-


System.out.println(10<20);    output  is       true


System.out.println('b'<20);    output  is         false   (hint: b's unicode value is greater )


System.out.println('b'<99.7);    output  is      true (hint: b's unicode value is lower)


System.out.println(true<false);   Compile Time Error(Cannot Applied to Boolean)


 


3.Relational Operators cannot be applied on Objects types.


example:-


System.out.println("javabychetan"<''blogspot");  


Compile Time Error (Cannot Applied to java.lang.String)


 


4.Nesting of Relational Operators is not Allowed.


example:-


System.out.println(10<20<30); 


 Compile Time Error (Cannot Apply to Boolean, Int)


 


No comments:

Post a Comment

Be the first to comment!

Don't just read and walk away, Your Feedback Is Always Appreciated. I will try to reply to your queries as soon as time allows.

Note:
1. If your question is unrelated to this article, please use our Facebook Page.
2. Please always make use of your name in the comment box instead of anonymous so that i can respond to you through your name and don't make use of Names such as "Admin" or "ADMIN" if you want your Comment to be published.

Regards,
JavaByChetan
Back To Home

Flipkart End Of Season Sale






© Copyright 2017 Javabychetan.blogspot.com