[Java in NetBeans] Lesson 02. Variables, Data Types and Assignment.
阿新 • • 發佈:2018-11-09
這個課程的參考視訊在youtube。
主要學到的知識點有:
- Data Type: int, char, String, double, boolean.
- When into printf, int (%d), char (%c), String (%s), double (%f), boolean (%). just like printf in C.
- input
- input.nextLine(); get a string by the next line.
- input.nextDouble();
- input.nextInt(); get a int by the next line.
- input.nextBoolean(); get a boolean by the next line.
- Arithmetic Operators : +, -, /, *, %
- Ternary Operator: e.g. gpa > 3.2 ? "good grade" : "bad grade"
- (type) can chang the type , e.g. (int) (totalScore/4.5);