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)