In this video you will learn what are the relational operators and their types.
Such operators which are used to comparetwo values, are called as relational operators. They generates result in true or false only.
We have following six relational operators in java:
1)Less than <
2)Less than or equals <=
3)Greater than >
4)Greater than or equals >=
5)Equals ==
6)Not equals !=
Example:
int a=10,b=5;
a<b gives false
a<=b gives false
a>b gives true
a<6 gives false
a>20 gives false
a==b gives false
a!=b gives true
a>=10 gives true
a>10 gives false
class RelationalOperators
{ public static void main(String[]args)
{ int a=10,b=5;
System.out.println(a<b);//false
System.out.println(a>b);//true
System.out.println(a<=10);//true
System.out.println(a>=b);//true
System.out.println(a==10);//true
System.out.println(a==b);//false
System.out.println(a!=b);//true
}
}
www.tarunsir.com
www.cinstitute.org.in
Connect me on linkedin https://www.linkedin.com/in/tarrunverrma
https://www.instagram.com/the_ultimate_coding_stuff/
#tarunsir #javatutorial #learnprogramming #relationaloperators #lessthan #lessthanorequals #greaterthan #greaterthanorequals #equals #notequals