[Java in NetBeans] Lesson 02. Variables, Data Types and Assignment.

这个课程的参考视频在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
  1. input.nextLine();  get a string by the next line. 
  2. input.nextDouble(); get a double by the next line.
  3. input.nextInt(); get a int by the next line. 
  4. 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

猜你喜欢

转载自www.cnblogs.com/Johnsonxiong/p/9820338.html
今日推荐