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 ...
随机推荐
- DSP TMS320C6000基础学习(7)—— Bootloader与VectorTable
本文主要简单记录C6000在启动装载过程和中断向量表的配置. 1. Bootloader 如上图, (1)在Device Reset阶段: 设备初始化为默认状态,大部分三态输出都配置为高阻态. (2) ...
- Julia语言:让高性能科学计算人人可用
Julia语言:让高性能科学计算人人可用要:一群科学家对现有计算工具感到不满:他们想要一套开源系统,有C的快速,Ruby的动态,Python的通用,R般在统计分析上得心应手,Perl的处理字符串处理, ...
- C#版考题
某软件大赛C#版考题整理——[单选题] 一.单选题(10小题共20.0分) 1. 以下JavaScript代码的正确输出结果是:(). 1 2 3 4 5 6 7 8 9 <script t ...
- Jquery EasyUI中treegrid
Jquery EasyUI中treegrid的中右键菜单和一般按钮同时绑定事件时的怪异事件 InChatter系统开源聊天模块前奏曲 最近在研究WCF,又因为工作中的项目需要,要为现有的系统增加一 ...
- [转]ARM/Thumb2PortingHowto
src: https://wiki.edubuntu.org/ARM/Thumb2PortingHowto#ARM_Assembler_Overview When you see some assem ...
- 企业架构研究总结(28)——TOGAF架构开发方法(ADM)之需求管理阶段
1.11 需求管理(Requirements Management) 企业架构开发方法各阶段——需求管理 1.11.1 目标 本阶段的目标是定义一个过程,使企业架构的需求可以被识别.存储并与其他架构开 ...
- 【Yom框架】漫谈个人框架的设计之一:是IRepository还是IRepository<T>?
前言 ...
- jquery validate 验证
JSP中引入 <link href="themes/gray/easyui.css" rel="stylesheet" type="text/c ...
- Elmah错误日志工具
Elmah错误日志工具 Exception 对于异常的处理,以前基本就是跳转到一个自定义的错误页面,觉得这样不错挺友好的.同时还是需要记录下来这些异常,才能进一步的进行修改. 怎么去记录这些错误信息呢 ...
- C# 枚举常用工具方法
/// <summary> /// 获取枚举成员描述信息及名称 /// 返回:IDictionary /// Value:描述信息 /// Key:值 /// </summary&g ...