Relation Operators (result is always a Boolean data type)
Boolean Data Type එකක් යනු 1 හෝ 0 යි.
මෙය True False ලෙසද අර්ථකථනය කළ හැක.
a=18 ; b=21; c=21 ;
Operators | Operator name | Usage | result |
== | Equal to | a == b | False |
!= | Not equal to | b != c | False |
> | Greater than | b > c | False |
< | Less than | a < b | True |
>= | Greater than or equal to | b >= c | True |
<= | Less than or equal to | b <= a | false |
Ex:
Class Javaguru1{
public static void main(String args[]){
int a=18; int b=21; int c=21;
System.out.println("Value of a : " + (a) );
System.out.println("Value of b: " + (b) );
System.out.println("Value of c : " + (c) );
System.out.println("a == b : " + (a==b) );
System.out.println("b != c : " + (b !=c) );
System.out.println("b > c : " + (b > c ) );
System.out.println("a < b : " + (a < b ) );
System.out.println("b >=c : " + (b >=c ) );
System.out.println("b <=a : " + (b <=a ) );
}
}
0 comments:
Post a Comment