Java编码规范(The Elements of Java Style)
Genaral Principles 一般约定
1.Adhere to the style
of the original.
保持最初的样式。
2.Adhere to the Principle of Least
Astonishment.
遵守最小惊奇原则。
3.Do it right the first time.
第一次就应当做好。
4.Document any deviations.
对于任何背离都应当文档注释。
Formatting
Conventions 格式约定
5.Indent nested code.
约束嵌套代码。
6.Break up long lines.
拆分长行。
7.Include white space.
包含空格。
8.Do not use "hard" tabs.
不要使用tab键。
Naming
Conventions 命名约定
9.Use meaningful names.
使用有意义的名称。
10.Use familiar names.
使用熟悉的名称。
11.Question excessively
long names.
不要使用过长的名称。
12.Join the vowel generation.
加入元音字母。
13.Capitalize only the first letter in acronyms.
只对简称的第一个字母大写。
14.Do not use names that differ only in case.
不要使用只依赖于大小写来区分的名称。
Package Names 包命名
15.Use
the reversed, lowercase form of your organization's Internet domain
name as the root qualifier for your package names.
采用你组织的Internet域名
的反转、小写形式作为包名称的根限定词。
16.Use a single, lowercase word as the root
name of each package.
使用一个唯一的小写单词作为每个包的根名称。
17.Use the
same name for a new version of a package, but only if that new version
is still binary compatible with the previous versin, otherwise, use a
new name.
只有当包的新版本仍然与旧版本兼容时,对于包的新版本使用相同的名称,否则使用新名称。
Type Names 类型命名
18.Capitalize the first letter of
each word that appears in a class or interface name.
对于类和接口名称只对每个单词
的第一个字母大写。
Class Names 类命名
19.Use
nouns when naming classes.
使用名词来命名类。
20.Pluralize the
names of classes that group related attributes,
相关文档:
// 删除时必须通过iterator.remove()来执行,不能直接使用set的remove()来执行,不然会出现java.util.ConcurrentModificationException异常
/* Iterator<String> delIter = keySet.iterator();
  ......
1、String是最基本的数据类型吗?
基本数据类型包括byte、int、char、long、float、double、boolean和short。
java.lang.String类是final类型的,因此不可以继承这个类、不能修改这个类。为了提高效率节省空间,我们应该用StringBuffer类
2、int 和 Integer 有什么区别
Java 提供两种不同的类型:引用类型和原始类型( ......
进一法: 即省略的位上只要大于零都要进一位 ;
四舍五入法: 即省略的位上小于五都要舍去,但省略的位上满五都要进一位 ;
还有一种
去尾法: 即省略的位上不管是否满五都要舍去 ;
1、除法带小数
例如:
int a = 8;
int b = 3;
int c = ((double)la)/b;
System.out.println(c); ......
Java动画编程有多种实现方法,但它们实现的基本原理是一样的,即在屏幕上画出一系列的帧来造成运动的感觉。Java多线程技术是Java动画编程中普遍运用的技术,它在控制动画程序的流程和动画的显示效果方面起着重要的作用。Java动画编程中的动画闪烁和图像残缺不全等现象,是Java程序员经常遇到的问题。本文以作者应用实例程序 ......
1.你需要精通面向对象分析与设计(OOA/OOD)、涉及模式(GOF,J2EEDP)以及综合模式。你应该十分了解UML,尤其是class,object,interaction以及statediagrams。
2.你需要学习JAVA语言的基础知识以及它的核心类库(collections,serialization,streams,networking, multithreadi ......