[Java in NetBeans] Lesson 02. Variables, Data Types and Assignment.
2018-10-20 04:13 Johnson_强生仔仔 阅读(235) 评论(0) 编辑 收藏 举报这个课程的参考视频在youtube。
主要学到的知识点有:
- Data Type: int, char, String, double, boolean.
- When into printf, int (%d), char (%c), String (%s), double (%f), boolean (%s). just like printf in C.
- input
- input.nextLine(); get a string by the next line.
- input.nextDouble(); get a double by the next line.
- 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); will change the result of (totoalScore/4.5) which is a float into integer.