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 ...
随机推荐
- Oracle琐碎笔记2
备注:以下所有操作均在sqlplus中执行. 开始前输入:spool c:\jiyi.txt;结束后输入:spool off;就会记忆操作的所有记录save c:\sql.sql;保存sql脚本可以使 ...
- NET系列文章
NET系列文章 由于博主今后一段时间可能会很忙(准备出书:<.NET框架设计—模式.配置.工具>,外加换了新工作),所以博客会很少更新: 在最近一年左右时间里,博主各种.NET技术类型的文 ...
- OrchardNoCMS
基于ASP.NET MVC的热插拔模块式开发框架(OrchardNoCMS)--BootStrap 按照几个月之前的计划,也应该写一个使用Bootstrap作为OrchardNoCMS的UI库.之前这 ...
- 通过反射生成SQL的例子
全文摘自http://www.cnblogs.com/g1mist/p/3227290.html,很好的一个实例. 反射提供了封装程序集.模块和类型的对象.您可以使用反射动态地创建类型的实例,将类型绑 ...
- 基于python的《Hadoop权威指南》一书中气象数据下载和map reduce化数据处理及其可视化
文档内容: 1:下载<hadoop权威指南>中的气象数据 2:对下载的气象数据归档整理并读取数据 3:对气象数据进行map reduce进行处理 关键词:<Hadoop权威指南> ...
- C语言中指针变量如何向函数中传递
指针变量存储的是地址,所以在函数调用的时候我们能否将指针变量传递给函数?如果不知道结果,那我们可以直接问电脑,输入如下一段代码. void GetMemory(char *p) { p = (char ...
- Restful?
为什么要Restful?为什么不Restful? 本随笔不说为什么要Restful,只说为什么不Restful.首先Http是超文本转移协议而不是控制协议.通常文档中也会使用“资源”来指代超文本. ...
- Linux下获取硬盘使用情况
Linux下获取硬盘使用情况[总结] 1.前言 在嵌入式设备中,硬盘空间非常有限,在涉及到经常写日志的进程时候,需要考虑日志的大小和删除,不然很快就硬盘写满,导致日志程序崩溃.为了捕获硬盘写满的异常场 ...
- Ubuntu环境搭建1
Ubuntu环境搭建(一) 其实每次重装Ubuntu系统的时候都要进行一次基本到环境配置,而且每次总会忘记一些环境配置到东西,所以就写下这个博文,方便自己以后重装系统的时候回顾,同时也给大家做为重装系 ...
- Java笔记:Java集合概述和Set集合
本文主要是Java集合的概述和Set集合 1.Java集合概述 1)数组可以保存多个对象,但数组长度不可变,一旦在初始化数组时指定了数组长度,这个数组长度就是不可变的,如果需要保存数量变化的数据,数组 ...