• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Operators In Java Step by Step Guide

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

Henry
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Mohsin!
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic