[Java in NetBeans] Lesson 04. Class / Objects
这个课程的参考视频和图片来自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的更多相关文章
- [Java in NetBeans] Lesson 15. Sorting and Searching.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Build in functions in java.util.Collections Need to implement a co ...
- [Java in NetBeans] Lesson 07. JavaDoc and Unit Tests
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. organize code into packages Create a package if want to make th ...
- [Java in NetBeans] Lesson 01. Java Programming Basics
这个课程的参考视频在youtube. 主要学到的知识点有: Create new project, choose Java Application. one .jar file/ package(.j ...
- [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 ...
- [Java in NetBeans] Lesson 17. File Input/Output.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...
- [Java in NetBeans] Lesson 16. Exceptions.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...
- [Java in NetBeans] Lesson 14. ArrayList and Collections
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Collection: container that contians objects. 2. Difference betw ...
- [Java in NetBeans] Lesson 09. Switch / If-Else Ladder
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Nested If-else statement (if-else ladder) /** * 90 and above == ...
- [Java in NetBeans] Lesson 06. Custom classes
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Constructors: A special method called when an object of the class ...
随机推荐
- php 逗号 explode分割字符串 或 implode组装成字符串
php 逗号 分割字符串 介绍两个函数给你 <?php //利用 explode 函数分割字符串到数组 $source = "hello1,hello2,hello3,hello4,h ...
- 在AJAX里 使用【 XML 】 返回数据类型 实现简单的下拉菜单数据
在AJAX里 使用XML返回数据类型 实现简单的下拉菜单数据 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN ...
- .NET Core开发日志——Filter
ASP.NET Core MVC中的Filter作用是在请求处理管道的某些阶段之前或之后可以运行特定的代码. Filter特性在之前的ASP.NET MVC中已经出现,但过去只有Authorizati ...
- {Python之进程} 背景知识 什么是进程 进程调度 并发与并行 同步\异步\阻塞\非阻塞 进程的创建与结束 multiprocess模块 进程池和mutiprocess.Poll
Python之进程 进程 本节目录 一 背景知识 二 什么是进程 三 进程调度 四 并发与并行 五 同步\异步\阻塞\非阻塞 六 进程的创建与结束 七 multiprocess模块 八 进程池和mut ...
- tensoflow模型中提示:ValueError: Variable rnn/basic_rnn_cell/kernel already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? 解决办法
在利用tensorflow框架进行模型训练的时候,有时我们需要多次训练对结果求均值来得到一个均衡的评测结论.比如训练十次求平均值.但是tf的本质就是图,当变量第一次定义使用后,第二次再使用就是提示: ...
- React组件中的key
React组件中的key 一.key的作用 react中的key属性,它是一个特殊的属性,它是出现不是给开发者用的(例如你为一个组件设置key之后不能获取组件的这个key props),而是给reac ...
- Exception 02 : java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver
异常名称 java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver 异常详细信息 ...
- cv_list
cv_list hmz http://cse.sjtu.edu.cn/OS/OS_files/page0012.htm 邹恒明博士: 美国密歇根大学(University of Michigan-An ...
- tortoisegit 常见错误disconnected no supported authentication methods available(server sent: publickey)
按如图操作 如果不能应用,Enable Proxy Server选中,再点击下面的应用及确定. 操作完上一部,用tortoisegit 下拉一次(git pull),即可解决
- cudnn升级之后caffe无法训练的问题
由于安装新版本的TensorFlow需要cudnn6.0因此用6.0将原来的 5.0替换了,后来又用之前编译好的caffe进行训练,发现caffe会去找5.0的cudnn,然后就报错了,不能正常训练. ...