Java Foundation---Rules for variable usage in Java (vi)

Source: Internet
Author: User

Rules for the use of variables in Java

Had to accept the variable little temper :

1. Variables in Java need to be declared before using 650) this.width=650; "src=" http://img.mukewang.com/53688962000154e005940070.jpg "/>

2, when the variable is used, you can declare the variable while initializing 650) this.width=650; "src=" http://img.mukewang.com/5358cc640001c54f01800024.jpg "/> can also be declared after the assignment 650) this.width=650; "src=" http://img.mukewang.com/5358cc220001e08901720044.jpg "/>

3, the variable can only assign one value at a time, but may modify multiple 650) this.width=650; "src=" http://img.mukewang.com/536889b300012af004300053.jpg "/>

4. The variables defined in the main method must be assigned before they can be output 650) this.width=650; "src=" http://img.mukewang.com/536889c000019eb805080079.jpg "/>

About string: Represents the type of data stored in a variable as a string, which is described in detail in the next section, Little anticipation ~ ~

Code:

public class helloworld{
public static void Main (string[] args) {
String city= "Henan";
System.out.println ("My Hometown in:" +city);
}
}


Running result: My hometown in: Henan

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

Java Foundation---Rules for variable usage in Java (vi)

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.