What is operators in java

operators: besically  operators is a symbol which is used to perform operation like add , multiply , devide etc. There is 5 types of operators in java:- Arthmetic operator bitwise operators assignment operators comparison operators logical operators Arthematic operators :- ex: package ...........; public class ............... { public static void main(String[] args) { int a = 10; int b = 20; int c = a+b; System.out.println(c); } } here we can perform adding multiplying etc....   Bitwise Operators:- right shift / left shift right shift: in this the number is halves ex: package ......; public class ..............{ public static void main(String[] args) { int a = 10; int b = a>>2; System.out.println(b); } }   left shift: in this number is double ex: ex: package ......; public class ..............{ public static void main(String[] args) { int a = 10; int b = a<<3; System.out.println(b); } }   ASSIGNMENT OPERATORS: ex. package ......; public class ......... { public static void main(String[] args) { int a = 10; a+=2; System.out.println(a); } } here we can use other operator (- ,%,*...) in place of "+"   COMPARISON OPERATOR: it's print true/false types:   type indication equal(=) == not equal != greater(>) > less(<) < greater equal >= less equal(=) <=   ex: package ......; public class ......... { public static void main(String[] args) { int a = 10; int b = 12; System.out.println(a>b); } }

0 Comments

End of content

No more pages to load