Home arrow Java & J2EE arrow Java Operators

Java Operators

It's been about a month or so since we finished our beginning Java series, so I'm sure you're ready for more. This time, I am going to teach you to work with operators in Java. When I am finished, you will be able to do complex mathematical equations, add one string of text to another, and build programs so powerful you will be able to put thousands of hard working Americans out of work with the push of a button.

TABLE OF CONTENTS:
  1. Java Operators
  2. Assignment Operators
  3. Doing More Math with Assignment Operators
  4. Forming a Relationship with Operators
By: James Payne
Rating: starstarstarstarstar / 21
October 22, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

So look out global economy, here we come.

Operators

There used to be a time when you called "Information" on the phone and you heard a real, honest-to-goodness voice. All that is done with. Now you talk to a computer, and the funny thing about computers is that they have no ears. So when I call up and, for example, ask for the number to Annie's Pizza, it's little surprise that the “operator” comes back to me with the number to Danny's Pizza, no matter how much emphasis I place on the A in Annie.

Unlike modern computer operators, Java Operators aren't annoying, and like the phone operators of old, are actually helpful. You have used operators your entire life, and their function is simple: they allow you to manipulate data. And let's face it, what good is data if you can't manipulate it?

There are several types of operators, but before we go into them, you should understand a little thing we in the biz call operator precedence. Precedence determines in which order operators execute. If that's not clear, it will be in a few moments.

But first, look at this beautiful table designed by yours truly:


Operator Type

Operator Precedence

postfix

expr++ expr--

unary

++expr –expr +expr -expr ~ !

multiplicative

* / %

additive

+ -

shift

<< >> >>>

relational

< > <= >= instanceof

equality

“==” !=

bitwise AND

&

bitwise exclusive OR

^

bitwise inclusive OR

|

logical AND

&&

logical OR

||

ternary

? :

assignment

“=” += -= *= /= %= &= ^= |= <<= >>= >>>=

The above table lists the operators and their precedence in order.



 
 
>>> More Java & J2EE Articles          >>> More By James Payne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVA & J2EE ARTICLES

- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: