public class HelloWorld{
public static void main(String[] args) {
int one = 10 ;
int two = 20 ;
int three = 0 ;
int three=one+two;
System.out.println("three=one+tow==>"+three);
int three+=one;
System.out.println("three+=one==>"+three);
int three-=one;
System.out.println("three-=one==>"+three);
int three*=tow/2;
System.out.println("three*=one==>"+three);
int three/=two*2;
System.out.println("three/=one==>"+three);
int three%=one;
System.out.println("three%=one==>"+three);
}
}
一个变量第一次出现的时候才需要规定类型, 这叫初始化; 之后就不用再强调它的类型直接使用three即可
好比方说你养了一只中华田园犬, 命名为大黄, 你就赋予这条狗大黄的名字, 你之后叫它, 直接叫大黄就好了, 不用再说'那只狗狗大黄'