Java learning notes (1):Basic Knowlege points
Basic Knowlege points:
1: it's necessary that there is only one public class in per .java file
2: .java file name should better to same as class name
3: when set the environment variable CLASSPATH, you should make sure the '.' path can't be lack of.
4: java is case sensitive, including .java file name , class name, variable name, method name and so on.
5: JVM uses automatic garbage collection machanism. It just collects memory source, not contains physical source, such as database connection, disk IO. You can invoke a collection through call static method System.gc().
6:Java is strong-type language, the variable shouble be declared firstly and then you can use it. ② the vairable only can accept the value which type is consistent with itself.
7: /** */ is used to add document annotation for java. javadoc command can export the code API document.
8: use '...' follow method parameter type, means has at least one parameter or more parameter. It equals type array type[]. it's similar with params in C#
9. In java, lamda expression use '->' symbol
10. From java 7, switch statement was allow to use String type, before just includes byte, int, char, shot four type.
11.For java, object instance can access the class static method or static field. but in c#, That's illegal.
12. For java, the package is similar with namespace in c#
13. for classes they belongs to same packege, don't have to at the same directory. That means there can be several packages with same name, but these packages should at different directory. And .class file should at the directory which name is same with its package name.
14. in java, 'instanceof' keyword equals 'is' in C#; there isn't keyword like as 'as'.
15. In Java, support initialization block , don't in c#.
public class A
{
{ ... block }
}
note: the execute order is that: create class object, initialize block, initialize field, constructor
if all class object have same logic, or initialize code, we can use static initialization block
16. In java, final keyword is same as sealed in c#.
17. the relationship of basic type with their packaged class

when convert between basic type with packaged class, system will boxing or unboxing automatically.
18. for value type and reference type which are defined by 'final' keyword', difference is following:
1. final value type can't be changed or modified anymore.
2. final reference type' reference which is pointer address is can't changed, but the object fields can be modified or changed.
Note: it's same as 'readonly' key word and 'const' key word in c#.
19. Object reference:
1. StrongReference ---- when system collect garbage, the object will not be recycled.
2. WeakReference ---- when system collect garbage, the object will be recycled compulsively.
3. PhatomReference ----- the object will be recycled compulsively. it can't get object address reference use PhatomReference. it just to use to trace the object.
4.SoftReference ------ when system collect garbage, if the memory is not enough , the object will be recycled compulsively.
Note: it's alse same as WeakReference in c#
Java learning notes (1):Basic Knowlege points的更多相关文章
- Mybatis Learning Notes 1
Mybatis Learning Notes 主要的参考是博客园竹山一叶的Blog,这里记录的是自己补充的内容 实体类属性名和数据库不一致的处理 如果是实体类的结果和真正的数据库的column的名称不 ...
- rt-thread learning notes
rt-thread learning notes 2018-01-15 > 001 具有相同优先级的线程,每个线程的时间片大小都可以在初始化或创建该线程时指定 rt_thread_t rt_th ...
- Java Learning Path(四) 方法篇
Java Learning Path(四) 方法篇 Java作为一门编程语言,最好的学习方法就是写代码.当你学习一个类以后,你就可以自己写个简单的例子程序来运行一下,看看有什么结果,然后再多调用几个类 ...
- Java Learning Path(五)资源篇
Java Learning Path(五)资源篇 1. http://java.sun.com/ (英文) Sun的Java网站,是一个应该经常去看的地方.不用多说. 2.http://www-900 ...
- Java Learning Path(三)过程篇
Java Learning Path(三)过程篇 每个人的学习方法是不同的,一个人的方法不见得适合另一个人,我只能是谈自己的学习方法.因为我学习Java是完全自学的,从来没有问过别人,所以学习的过程基 ...
- Java Learning 001 新建一个Java工程 HelloWorld程序
Java Learning 001 新建一个Java工程 HelloWorld程序 Step 1 . 在Eclipse 软件里,点击: File -> New -> Java Projec ...
- Java Learning 000 搭建开发环境
Java Learning 000 搭建开发环境 你需要两个软件: * JDK (Java Develop Kit :Java开发工具包) * eclipse (eclipse 集成开发环境软件) 安 ...
- Rust learning notes
Rust learning notes Rust Version 1.42.0 $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs ...
- Coursera, Machine Learning, notes
Basic theory (i) Supervised learning (parametric/non-parametric algorithms, support vector machine ...
随机推荐
- 二分法-C++
对于一个非线性方程f(x)=0求改方程的根,我们的思路可以这么想: 1.根的存在性.若该方程没有根,何必徒劳想法设法去求它的解呢?对于一个方程,我们怎么去找他的根,有连续函数零点定理可知:若有f(a) ...
- Day1:T3 bfs T4 树形DP
T3:BFS 回看了一下Day1的T3...感觉裸裸的BFS,自己当时居然没有看出来... 同时用上升和下降两种状态bfs即可 这一题还要注意一个细节的地方,就是题目要求的是求往返的最优解 k=min ...
- 基于.NET打造IP智能网络视频监控系统
开源倾情奉献:基于.NET打造IP智能网络视频监控系统(一)开放源代码 开源倾情奉献系列链接 开源倾情奉献:基于.NET打造IP智能网络视频监控系统(一)开放源代码 开源倾情奉献:基于.NET打造 ...
- Asp.net MVC集成Google Calendar API(附Demo源码)
Asp.net MVC集成Google Calendar API(附Demo源码) Google Calendar是非常方便的日程管理应用,很多人都非常熟悉.Google的应用在国内不稳定,但是在国外 ...
- 反向代理-- WEB服务的加速器[转]
昨天j.L问我http cache怎么设置,当时脑子有点糊涂,一时没想到其实他问的就是反向代理如何设置. 首发:PHP CUP xiaobao 什么是反向代理?反 向代理就是代理服务器(如ISA.Sq ...
- andriod手机签到应用服务器架构
andriod手机签到应用服务器架构 最近导师要求我和另一个同学开发一个手机上课签到应用,我负责客户端和服务器之间的通信架构编写和数据的存储 本人大学四年只用过汇编和C/C++,因此对andriod开 ...
- jquery禁用右键单击、F5刷新
1.禁用右键单击功能 $(document).ready(function() { $(document).bind("contextmenu",function(e) { ale ...
- javascript中字符串常用操作整理
javascript中字符串常用操作整理 字符串的操作在js中非常频繁,也非常重要.以往看完书之后都能记得非常清楚,但稍微隔一段时间不用,便会忘得差不多,记性不好是硬伤啊...今天就对字符串的一些常用 ...
- 简单实现TCP下的大文件高效传输
简单实现TCP下的大文件高效传输 在TCP下进行大文件传输不象小文件那样直接打包个BUFFER发送出去,因为文件比较大所以不可能把文件读到一个BUFFER发送出去.主要有些文件的大小可能是1G,2G或 ...
- 图解JOIN
阅读导航 一.概要 二.JOIN分类 三.JOIN分类详解 一.概要 JOIN对于接触过数据库的人,这个词都不陌生,而且很多人很清楚各种JOIN,还有很多人对这个理解也不是很透彻,这次就说说JOIN操 ...