public class HelloWorld{
public static void main(String[] args) {
int one = 10 ;
int two = 20 ;
int three = one+two ;
int three += one;
int three -=one;
int three *=one;
int three %=one;
System.out.println("one"):
}
}
three声明过数据类型,就不用反复的声明数据类型。
int three += one; int three -=one; int three *=one; int three %=one;
所以这里全部的数据类型int去掉。
System.out.println("one"):
输出语句最后是;,不是:。加引号是输出字符串,不加引号是输出变量。
运算结果就是10