1. java project structure
project > module > package > class
2. psvm //shorthand ------public static void main
3. sout //shorthand ---- System.out.println();
4. 取值的range
byte < short < int < long < float < double
5. 数据类型不一样,不能进行计算,需要转成统一一样的才可以计算
6. 转换规则1:
取值范围小的,和取值范围大的进行计算,小的会先提升打的,在进行计算
7. 转换规则1:
byte short char 这三种数据在计算的时候,都会直接提升为int, 然后再计算
8. assignment operator
9. exercise 1
import java.util.Scanner; public class Main { public static void main(String[] args) { /*需求: 您和您的约会对象正试图在餐厅获得一张桌子。 键盘录入两个整数,表示你和你约会对象衣服的时髦度。(手动录入010之间的整数,不能录其他) 如果你的时髦程度大于你对象的时髦程度,相亲就成功,输出true。 否则输出false。*/ //1.键盘录入两个整数表示衣服的时髦度 Scanner sc = new Scanner(System.in); System.out.println("enter your level"); int myFashion = sc.nextInt(); System.out.println("enter her level"); int girlFashion = sc.nextInt(); //2.把我衣服的时髦度跟女孩的时髦度进行对比就可以了 boolean result = myFashion > girlFashion; //3.打印结果 System.out.println(result); } }
10. logical operation
11.