Web-android Engineer first-3-1 what is an operator

Source: Internet
Author: User

Source: http://www.imooc.com/code/1278

An operator is a "function" symbol that informs Java about the operation. For example, if we need to set the value of the variable age to 20, we need a "=" to tell the program that it needs to be assigned.

The common operators in the Java language can be divided into the following types:

Ø arithmetic operators

Ø assignment operator

Ø comparison Operators

Ø logical operators

Ø conditional operator

Task

Let's try to look at the use of operators in a simple example!

When calculating the sum of two numbers, you need to use the addition operator. In Java, the addition operator uses "+" to denote

In the editor, line 5 enters:

int sum = a + b;

Check the results of the operation:

1  Public class helloworld{2      Public Static void Main (string[] args) {3         int a=12; 4         int b=24; 5         6         System.out.println ("Sum of two numbers:" + sums); 7     }8 }

Web-android Engineer first-3-1 what is an operator

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.