(c) operator

Source: Internet
Author: User
Operator 1, arithmetic operators


Note: ①++ and – can appear either to the left of the operand or to the right, but the result is a different drop




②/refers to the addition of the integer part, the decimal point is omitted;

2, assignment operator


Note: ① only write Three+=one can, do not write int three+=one;

②public static void Main (string[] args) with a pair of {}
Fill in the specific instructions, only with this one, do not open a pair of {}, because only run out of the first {} instruction, so all in the first {} write on the line, rest assured that as long as there is the corresponding output System.out.println ("Three%= one ==>:" +three ) can

3, Comparison operators


①>, <, >=, <= only support the left and right sides of the operand is a numeric type;
The operands on both sides of ②==,! = can be either numeric types or reference types;
③a==b represents a equals b;a=b value for B is assigned to a (AB can be a number, or it can be a string);

4, logical operators


①true and False are the Boolean numbers that are recognized in Java and can be used directly:
Boolean c=true;
②system.out.println ((c&&d) + ": Failed"), and System.out.println ("a equals B:" + (a==b));

Shortcut key: Ctrl + Z to undo the last; Ctrl+y to move on to the next

5, conditional operator

Syntax form: boolean expression? Expression 1: Expression 2
Operation procedure: Returns the value of expression 1 if the value of the Boolean expression is true, otherwise returns the value of expression 2


Because the value of the expression 8>5 is true, the output: 8 is greater than 5

6, priority


In fact, you can add () to make it a priority

(c) 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.