JAVA meta operator, unary operator, binary operator, ternary operator, java Operator

Source: Internet
Author: User

JAVA meta operator, unary operator, binary operator, ternary operator, java Operator

Unary operator:

Serial number Unary operator Description
1 I ++ Add 1 to I
2 I -- Reduce I by 1
3 ++ I Add 1 to I
4 -- I Reduce I by 1

 

 

 

 

 

I ++;
/*
Example:
Int I = 1;
I ++; // first assign the value 1 of I to I, And then I adds 1
*/I --;
/* Same as above */++ I;
/*
Example:
Int I = 1;
++ I; // first assign the I + 1 value
*/
-- I;
/* Same as above */

 

Binary Operators

Serial number Binary Operators Description
1 + Add
2 - Subtraction
3 * Multiplication
4 / Division
5 % Remainder

 

 

 

 

 

 

Ternary Operators

int i    =    150;
int c    =    i<100?100:200;
System.out.println(c);

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.