这个课程的参考视频和图片来自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. 录制用户的音频,视屏 navigator.mediaDevices.getUserMedia

    google 文档 HACKS 文档 相关代码 获取本地的音频 <input type="file" accept="audio/*" capture=& ...

  2. - Fractal(3.4.1)

    C - Fractal(3.4.1) Time Limit:1000MS    Memory Limit:30000KB    64bit IO Format:%I64d & %I64u Su ...

  3. 洛谷试炼场-简单数学问题-P1088 火星人

    洛谷试炼场-简单数学问题 A--P1088 火星人 Description 人类终于登上了火星的土地并且见到了神秘的火星人.人类和火星人都无法理解对方的语言,但是我们的科学家发明了一种用数字交流的方法 ...

  4. ESP8266 的几个代码 加深对LUA的理解

    --some functions dofile("functions.lua") lighton1= lighton2= lighton3= lighton4= pin1 = pi ...

  5. [No0000105]java sdk 开发环境变量powershell 自动配置脚本

    # 设置Java SDK 环境变量 $softwares = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Unin ...

  6. CHARACTER SET

    mysql> show tables; +-----------------+ | Tables_in_w0811 | +-----------------+ | t | | w_engine ...

  7. knowledge learning things TODO

    加密分区 suricata调研 tor配置 tilda配置 automake / autoconf / libtool 使用 大页内存的深入原理 Memory channels Network Man ...

  8. 使用@import导入实现了ImportBeanDefinitionRegistrar接口的类,不能被注册为bean

    今天在调试公司spring项目的时候发现了这样一个问题,由于我们的项目使用的是springboot就以springboot为例,代码如下: @Import({DataSourceRegister.cl ...

  9. ES6面试题总结

    1.说出至少5个ES6的新特性,并简述它们的作用.(简答题) 1.let关键字,用于声明只在块级作用域起作用的变量: 2.const关键字,用于声明一个常量: 3.结构赋值,一种新的变量赋值方式.常用 ...

  10. oracle中is和as的区别

    在存储过程(PROCEDURE)和函数(FUNCTION)中没有区别:在视图(VIEW)中只能用AS不能用IS:在游标(CURSOR)中只能用IS不能用AS.