package Chapter6;
public class Operator {
/*
算術(shù)運(yùn)算符
關(guān)系運(yùn)算符
位運(yùn)算符
邏輯運(yùn)算符
賦值運(yùn)算符
其他運(yùn)算符
與iOS中的運(yùn)算符 沒有很大的出入*/
public static void main(String args[]) {
int a = 10;
int b = 20;
int c = 25;
int d = 25;
System.out.println("a + b = " + (a + b) );
System.out.println("a - b = " + (a - b) );
System.out.println("a * b = " + (a * b) );
System.out.println("b / a = " + (b / a) );
System.out.println("b % a = " + (b % a) );
System.out.println("c % a = " + (c % a) );
System.out.println("a++ = " + (a++) );
System.out.println("a-- = " + (a--) );
// 查看 d++ 與 ++d 的不同
System.out.println("d++ = " + (d++) );
System.out.println("++d = " + (++d) );
// variable x = (expression) ? value if true : value if false
// ( Object reference variable ) instanceof (class/interface type)
}
}
循環(huán)結(jié)構(gòu)
package Chapter7;
public class CircleStructure {
/*
while 循環(huán)
do…while 循環(huán)
for 循環(huán)*/
/*分支結(jié)構(gòu):
if 語句
switch 語句*/
}