explain various operator in java, also comment how they are different from c++. Operators
After having seen the basic types in Java and how to declare variables of each type, we are now going to show what basic operations can be performed with and on variables of the basic types. Below is a table summarizing Java operators organized by the type of operation the operator is used for. There are 8 types of operator that is follow :-

1 )- Arithmetic Operators
2)- Logic Operators
3)- Bitwise Operators
4)- Assignment Operators
5)- The Conditional Operators
6)- Increment and decrement operators
7)- Special operator
8)- Relational operator

Description of these operators :-
Arithmetic Operators
The arithmetic operators -, +, * and / can be used to perform respectively subtraction, addition, multiplication and division with integers and reals. Example :-
1
2int result = 3 * 56;
double answer = 3.14 + 2.72;
Logic Operators
The logic operators &&, ||, ! and ^ can be used to perform respectively logical and, or, not and exclusive-or on boolean operands. Example:
1
2System.out.println(true || false); /* outputs true */ System.out.println(! true); /* outputs false */
Bitwise Operators
The bitwise operators &, |, ^, ~, and >>> can be used to perform bitwise and, or, exclusive-or, negation, left shift and right shift on integer operands. Note that there are two types of right shift: >> and >>>. The difference being that >> copies the sign bit into the high-order positions and >>> copies zeros into the high-order positions. Example:

1
2System.out.println(12 & 5); /* outputs 4 because 1100 & 0101 = 0100 = 4 */ System.out.println(3 >= all require a location (a variable) on the left side and an expression of the same type (or one that could be promoted to the same type) on the right side. The basic assignment operator = evaluates the expression on the right and stores the resulting value in the location on the left....

{"essaysImgCdnUrl":"\/\/images-study.netdna-ssl.com\/pi\/","thumb_default_size":"160x220","thumb_ac_size":"80x110","isPayOrJoin":false,"essayUpload":false,"site_id":1,"autoComplete":true,"logPixelPath":"\/\/www.smhpix.com\/pixel.gif","tracking_url":"\/\/www.smhpix.com\/pixel.gif","essay":{"essayId":35679721,"categoryName":"Fiction","categoryParentId":"17","currentPage":1,"format":"text","pageMeta":{"text":{"startPage":1,"endPage":5,"pageRange":"1-5","totalPages":5}},"access":"premium","title":"Explain Various Operator in Java, Also Comment How They Are Different from C++.","additionalIds":[5,3,7,93],"additional":["Computer Science","Business & Economy","Education","Education\/Greek System"],"loadedPages":{"html":[],"text":[1,2,3,4,5]}},"user":null,"canonicalUrl":"http:\/\/www.studymode.com\/essays\/Explain-Various-Operator-In-Java-Also-969236.html","pagesPerLoad":50,"userType":"member_guest","ct":10,"ndocs":"1,500,000","pdocs":"6,000","cc":"10_PERCENT_1MO_AND_6MO","signUpUrl":"https:\/\/www.studymode.com\/signup","joinUrl":"https:\/\/www.studymode.com\/join","payPlanUrl":"\/checkout\/pay\/1010","upgradeUrl":"\/checkout\/upgrade","freeTrialUrl":"https:\/\/www.studymode.com\/signup?redirectUrl=https%3A%2F%2Fwww.studymode.com%2Fcheckout%2Fpay%2Ffree-trial&bypassPaymentPage=1","joinFreeUrl":"\/essays\/?newuser=1","siteId":1,"facebook":{"clientId":"306058689489023","version":"v2.2","language":"en_US"},"analytics":{"googleId":"UA-32718321-1"}}

## Share this Document

Let your classmates know about this document and more at StudyMode.com