Assignment operator in Java Foundation--java (12)

Source: Internet
Author: User

Assignment operators in Java

An assignment operator is a symbol that specifies a numeric value for a variable or constant. If you can use "=" to assign the result of the right expression to the left operand.

Common assignment operators supported by Java, as shown in the following table:

650) this.width=650; "src=" http://img.mukewang.com/5360ebdb0001401b04430144.jpg "/>


Code:

public class helloworld{
public static void Main (string[] args) {
int one = 10;
int: 20;
int three = 0;

three = One+two;
System.out.println ("three= one+two ==>" + three);
three + = one;
System.out.println ("Three +=one ==>" + three);
Three-=one;
System.out.println ("Three-=one ==>" + three);
Three *=one;
System.out.println ("Three *= one ==>" + three);
Three/=one;
System.out.println ("Three/=one ==>" + three);
Three%=one;
System.out.println ("Three%=one ==>" + three);


Operation Result:

Three= One+two ==>30
Three +=one ==>40
Three-=one ==>30
Three *= one ==>300
Three/=one ==>30
Three%=one ==>0

This article is from "Ghost" blog, please make sure to keep this source http://caizi.blog.51cto.com/5234706/1547666

Assignment operator in Java Foundation--java (12)

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.