My Creation RelationalOperators in Java

2 40
Avatar for Anne10
Written by
4 years ago

public class RelationalOperators {

public static void main(String[] args) {

int x = 1;

int y = 3;

int z = 2;

boolean result;

System.out.println();//add a new line

System.out.println("Relational Operation:");

System.out.println();

System.out.println("Equal to:");

result = x==y; //checks if two values are equal

System.out.println(x+"=="+y+"="+result);

result =x==z;//checks if two values are equal

System.out.println(x+"=="+z+"="+result);

System.out.println();

System.out.println("Not Equal to:");

result=x!=y;//checks if two values are not equal

System.out.println(x+"!="+y+"="+result);

result =x==z;//checks if two values are equal

System.out.println(x+"!="+z+"="+result);

System.out.println();

System.out.println("Greater than:");

result=y>x;//checks if two the values are not equal

System.out.println(y+">"+x+"="+result);

result=x>z;//checks if the two values are equal

System.out.println(x+">"+z+"="+result);

System.out.println();

System.out.println("Less than:");

result=x<y;//checks if the two values are not equal

System.out.println(x+"<"+y+"="+result);

result=x<z;//checks if the two values are equal

System.out.println(x+"<"+z+"="+result);

System.out.println();

System.out.println("Greater than or Equal to:");

result=y>=x;//checks if two the values are not equal

System.out.println(y+">="+x+"="+result);

result=x>=z;//checks if the two values are equal

System.out.println(x+">="+z+"="+result);

System.out.println();

System.out.println("Less than or Equal to:");

result=x<=y;//checks if two the values are not equal

System.out.println(x+"<="+y+"="+result);

result=x<=z;//checks if the two values are equal

System.out.println(x+"<="+z+"="+result);

}

}

2
$ 0.16
$ 0.16 from @TheRandomRewarder
Avatar for Anne10
Written by
4 years ago

Comments

Sir ikaw tuh sir diba di ako nka subs sau niw plang haha

$ 0.00
4 years ago

cgi subs to subs nlng tayu

$ 0.00
4 years ago