这个课程的参考视频和图片来自youtube

主要学到的知识点有:

  • Class: Blueprint for an object. (e.g. dog is a class)
  • Object: custom variables contain state an behavior. (e.g. a two-year old husky is an object of a class dog, it's age is 2, and behavior is bark. then it will have methods like "bark()", "eat(food)")

Define an object:

  • If we want to use the classes defined in Java, like Scanner, Random . Then need to use import method to import the class libraries. ("Ctrl + Shifl + i "will automatic import/unimport the packages can be refered) Might also need to import the packages of others or packages in other projects.
import java.util.Random;
  • Show javadoc will help you to understand how to use the class or method. This is an example of the Random class we just import above.
// Generator a random number between 0 - 9

Random generator = new Random();
int i = generator.nextInt(10);
  • Reverse a string use StringBuilder.

    String forward = "This is a test";
    StringBuilder sb = new StringBuilder();
    sb.append(forward);
    // StringBuilder sb = new StringBuilder(forward); is the same like last two lines.
    String reverseString = sb.reverse().toString();
    System.out.println(reverseString); // System output result will be:
    // !tset a si sihT
  • Math.PI will present pi which is 3.14.... in math. ("Tab" is also our friend to see methods that we can use, so press "Tab" after Math.)
double circ = 2 * Math.PI * radius;

[Java in NetBeans] Lesson 04. Class / Objects的更多相关文章

  1. [Java in NetBeans] Lesson 15. Sorting and Searching.

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Build in functions in java.util.Collections Need to implement a co ...

  2. [Java in NetBeans] Lesson 07. JavaDoc and Unit Tests

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. organize code into packages Create a package if want to make th ...

  3. [Java in NetBeans] Lesson 01. Java Programming Basics

    这个课程的参考视频在youtube. 主要学到的知识点有: Create new project, choose Java Application. one .jar file/ package(.j ...

  4. [Java in NetBeans] Lesson 00. Getting Set-up for Learning Java

    这个课程的参考视频在youtube. 主要学到的知识点有: set up needs Java SE JDK, NetBeans IDE class name should be the same l ...

  5. [Java in NetBeans] Lesson 17. File Input/Output.

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...

  6. [Java in NetBeans] Lesson 16. Exceptions.

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...

  7. [Java in NetBeans] Lesson 14. ArrayList and Collections

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Collection: container that contians objects. 2. Difference betw ...

  8. [Java in NetBeans] Lesson 09. Switch / If-Else Ladder

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Nested If-else statement (if-else ladder) /** * 90 and above == ...

  9. [Java in NetBeans] Lesson 06. Custom classes

    这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Constructors: A special method called when an object of the class ...

随机推荐

  1. ZOJ Problem Set - 2014 Piggy-Bank【完全背包】

    Description Before ACM can do anything, a budget must be prepared and the necessary financial suppor ...

  2. 泡泡一分钟:Automatic Parameter Tuning of Motion Planning Algorithms

    Automatic Parameter Tuning of Motion Planning Algorithms 运动规划算法的自动参数整定 Jos´e Cano, Yiming Yang, Brun ...

  3. process 多进程写法 multiprocessing

    from multiprocessing import Process def   f1(n):#普通 print(f1) if __name__ == '__main__': lst = [] fo ...

  4. [No0000134]C#中的委托,匿名方法和Lambda表达式

    简介 在.NET中,委托,匿名方法和Lambda表达式很容易发生混淆.我想下面的代码能证实这点.下面哪一个First会被编译?哪一个会返回我们需要的结果?即Customer.ID=5.答案是6个Fir ...

  5. acid. cap

    BASE是下面三个术语的缩写: 基本可用(Basically Available) 软状态(Soft state) 最终一致(Eventually consistent) 目前最快的KV数据库,10W ...

  6. Delphi maskedit控件的掩码含义及用法方法

    Delphi maskedit控件的掩码含义及用法方法   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 ...

  7. 配置ASM以及创建恢复目录

    本次配置ASM沿用了搭建RAC的环境配置,系统选用CENTOS6.8 首先本地配置YUM,安装GRID集群件所需要的RPM包 [root@rac01 Packages]# cd /etc/yum.re ...

  8. 用canvas把页面中所有元素的轮廓绘制出来

    function plot(){//绘制函数 // 创建一个canvas画布 const canvas=document.createElement("canvas"); canv ...

  9. 【PyQt5-Qt Designer】工具箱(QToolBox)用法讲解

    QToolBox() 实现抽屉效果 总体介绍: QToolBox类提供了一列选项卡的小部件(选项卡内含项目). 工具箱是一个小部件,它将选项卡一个一个的显示,当前项目显示在当前选项卡下方.每个选项卡在 ...

  10. Win7 开机自动启动Outlook2010

    工作中,设置一些开机启动项,可以提供工作效率,下面演示设置Outlook2010在win7系统开机自启动,其它软件,如Eclipse.微信等,也可以这么配置. 环境: win7,outlook 201 ...