这个课程的参考视频和图片来自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. PHP基础语法 【】【】 PHP函数

    <?php //注释语法 /* 多行注释 */ //输出语法 echo "hello"; echo "world","dhakj"; ...

  2. 依赖注入容器之Castle Windsor

    一.Windsor的使用 Windsor的作为依赖注入的容器的一种,使用起来比较方便,我们直接在Nuget中添加Castle Windsor,将会自动引入Castle.Core 和 Castle.Wi ...

  3. SSH框架下的表单重复提交

    前几天做了一个功能,是在某个操作后,刷新父页面的,刷新时弹出了下面图的框: 网上查了之后发现这个框是表单重复提交时出现的.分析后发现,这个页面的上一个动作是form submit(在ssh框架下),这 ...

  4. 树剖||树链剖分||线段树||BZOJ4034||Luogu3178||[HAOI2015]树上操作

    题面:P3178 [HAOI2015]树上操作 好像其他人都嫌这道题太容易了懒得讲,好吧那我讲. 题解:第一个操作和第二个操作本质上是一样的,所以可以合并.唯一值得讲的点就是:第二个操作要求把某个节点 ...

  5. 一劳永逸:域名支持通配符,ASP.NET Core中配置CORS

    ASP.NET Core 内置了对 CORS 的支持,使用很简单,只需先在 Startup 的 ConfigureServices() 中添加 CORS 策略: public void Configu ...

  6. vmware虚拟的ubuntu18.04死机,尝试关闭时关机报“虚拟机xxx繁忙”

    找到虚拟机文件所在目录 打开vmware.log,第一行,找pid到pid=xxx,这就是CPU进程的id. 打开资源监视器,选CPU选项卡,找到这个PID,右键,结束进程. 再打开vmware尝试启 ...

  7. Hive中的order by、sort by、distribute by、cluster by解释及测试

    结论: order by:全局排序,这也是4种排序手段中唯一一个能在终端输出中看出全局排序的方法,只有一个reduce,可能造成renduce任务时间过长,在严格模式下,要求必须具备limit子句. ...

  8. mysq数据库基本操作

    MySQL的数据库名称,表名称是区分大小写,MySQL 的SQL keywords不区分大小写: if when you attempt to log in, you get an error mes ...

  9. [daily] SNAT和DNAT

    SNAT,DNAT,MASQUERADE都是NAT MASQUERADE是SNAT的一个特例 SNAT是指在数据包从网卡发送出去的时候,把数据包中的源地址部分替换为指定的IP,这样,接收方就认为数据包 ...

  10. dp进阶——饥饿的奶牛

    饥饿的奶牛oj上n只有1000,过于水,O(n^2)的算法很容易水过,洛谷上这是一道提高加的题,很难啊,所以要好好拿来练习今天写博客再次复习一下,oi最怕遗忘了. 这道题呢实质是一个区间覆盖的dp,首 ...