• Post Reply Bookmark Topic Watch Topic
  • New Topic

Operators In Java Step by Step Guide  RSS feed

 
mohsin haroon
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For All Java Tutorials And queries Must Visit >>> Java Reborns: Your Step By Step Guide To Java Coding

A set of symbols is used to indicate the kind of operation to be performed on data. These symbols are called operators.
Consider the expression:
Z = X + Y;
The + symbol in the statement is called the Operator and the operation performed is addition. This
operation is performed on the two variables X and Y, which are called as Operands. The combination of both the operator and the operands, Z = X + Y, is known as an Expression.
Java provides several categories of operators and they are as follows:

Assignment Operator

Arithmetic Operator

Unary Operator

Conditional Operator

Logical Operator

Assignment Operator

Bitwise Operator

Assignment Operators
The basic assignment operator is a single equal to sign, ‘=’. This operator is used to assign the value on its right to the operand on its left. Assigning values to more than one variable can be done at a time. In other words, it allows you to create a chain of assignments.Consider the following statements:




The value 3456 and ‘M’ are assigned to the variables, balance and gender.




Arithmetic Operators
Arithmetic operators manipulate numeric data and perform common arithmetic operations on the data. Operands of the arithmetic operators must be of numeric type. Boolean operands cannot be used, but character operands are allowed. The operators mentioned here are binary in nature that is, these operate on two operands, such as X+Y. Here, + is a binary operator operating on X and Y.



Unary Operator
Unary operators require only one operand. They perform various operations such as incrementing/
decrementing the value of a variable by 1, negating an expression, or inverting the value of a boolean
variable.
lists the unary operators.
Operator Description
+ Unary plus - Indicates a positive value
- Unary minus - Negates an expression
++ Increment operator - Increments the value of a variable by 1
-- Decrement operator - Decrements the value of a variable by 1
! Logical complement operator - Inverts a boolean



Article copied From Java Reborns: Your Step By Step Guide To Java Coding

For COmplete Tutorial Of Java Operators visit here Operators in Java
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Let's move this to our blogging around the campfire forum.

Henry
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Mohsin!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!