Java meta-operator, unary operator, two-ary operator, ternary operator

Source: Internet
Author: User

Unary operators:

Serial number Unary operators Description
1 i++ Add 1 to I
2 i-- Minus 1 for I
3 ++i Add 1 to I
4 -I. Minus 1 for I

i++;
/*
Cases:
int i=1;
i++;//first assigns the value of I 1 to I, then I plus 1
*/i--;
/* Ibid./+ +i;
/*
Cases:
int i=1;
++i;//the i+1 first, and then assigns the value to I
*/
I.;
/* Ditto */

Binary operators

Serial number Binary operators Description
1 + Add
2 - Reducing
3 * By
4 / Except
5 % Take surplus

Ternary operators

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

Java meta-operator, unary operator, two-ary operator, ternary operator

Related Article

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.