Professional Documents
Culture Documents
Sea113 Oopml Exp1
Sea113 Oopml Exp1
The result of all relational operators is always of a boolean type. It returns always true or
false.
Relational operators are mainly used to create conditions in decision statements
The six relational operators are < , > , <= , >= , == , and != .
class Raltional {
//Lessthan operator
System.out.println("a < b = " + (a < b) );
class BoolLogic
{
public static void main(String[] args)
{ //initializing the values of variables
boolean a = true;
boolean b = false;
boolean c = a | b;
boolean d = a & b;
boolean e = (!a & b) | (a & !b);
boolean f = a ^ b;
class leftshift{
public static void main(string[] args){
//initializing variables
int a = 10, b = 0, b = a<<2;
//Declaring left shift operator result
System.out.println("a<<2 = " + b);
}
}
OUTPUT
class rightshift{
public static void main(string[] args){
//initializing variables
int a = -10, b = 0, b = a>>2, c = 0, c = a>>>2;
class Inbuilt{
//Returns the the value of of first when raised to the power of second
System.out.println("power of x and y: " + Math.pow(x,y));