Java 2 核心技巧 卷1 根蒂根基常识 进修笔记   
               添加时间:2013-5-5 点击量: 
 
              Java 2 核心技巧 卷1 根蒂根基常识 进修笔记
跳过7-10章
景象变量设置
Windows下  体系变量  jdk1.7@win7
1)java_home : jdk安装目次
2)classpath : 
.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
3)Path : 
%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
cmd下运行 java -version ,查看是否设备成功
 
将代码的编译错误输出到txt文件中
1 javac Test.java 2> error.txt
新的错误输出文件会直接覆盖旧的
 
运行applet
1 javac Test.java
2 appletviewer Test.html
0 x1.0p-3 默示十进制 0.125 ,p默示指数
1 if(Double.isNaN(x)) // 检测x是不是一个数
Eclipse 中文件主动添加注释: java-code style-code templates-comments
Eclipse 中设置.java的Tab大小,java-code style-Formatter
浮点数除以0获得 无穷大 或 NaN
舍入运算
1 double x = 9.9;
2 int nx = (int) Math.round(x); // x=10
1 for (int element : a)
2    System.out.println(element); // 输出数组a的每一个元素
1 GregorianCalendar calendar = new GregorianCalendar(year, month-1 ,day); //0默示一月
Eclipse source-Organize Imports // 具体导入
 
 1 public boolean equals(Object otherObject)  {  
 2     // a quick test to see if the objects are identical
 3     if (this == otherObject) return true;
 4 
 5     // must return false if the explicit parameter is null
 6     if (otherObject == null) return false;
 7 
 8     // if the classes dont match, they cant be equal
 9     if (getClass() != otherObject.getClass())
10         return false;
11 
12     // now we know otherObject is a non-null Employee
13     Employee other = (Employee) otherObject;
14 
15     // test whether the fields have identical values
16     return name.equals(other.name)
17         && salary == other.salary
18         && hireDay.equals(other.hireDay);
19 }
1 public int hashCode()  {   
2     return 7  name.hashCode() 
3         + 11  new Double(salary).hashCode()
4         + 13  hireDay.hashCode();
5 }
Error : 体系内部错误 或 资料耗尽
Exception:IOException 和 RuntimeException-由法度错误导致
ArrayIndexOutOfBoundsException-数组下标越界
NullPointException-变量为空
真正的心灵世界会告诉你根本看不见的东西,这东西需要你付出思想和灵魂的劳动去获取,然后它会照亮你的生命,永远照亮你的生命。——王安忆《小说家的十三堂课》
                     
                  
     
  
 
    
    
Java 2 核心技巧 卷1 根蒂根基常识 进修笔记
跳过7-10章
景象变量设置
Windows下  体系变量  jdk1.7@win7
1)java_home : jdk安装目次
2)classpath : 
.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
3)Path :
%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
cmd下运行 java -version ,查看是否设备成功
 
将代码的编译错误输出到txt文件中
1 javac Test.java 2> error.txt
新的错误输出文件会直接覆盖旧的
 
运行applet
1 javac Test.java
2 appletviewer Test.html
0 x1.0p-3 默示十进制 0.125 ,p默示指数
1 if(Double.isNaN(x)) // 检测x是不是一个数
Eclipse 中文件主动添加注释: java-code style-code templates-comments
Eclipse 中设置.java的Tab大小,java-code style-Formatter
浮点数除以0获得 无穷大 或 NaN
舍入运算
1 double x = 9.9;
2 int nx = (int) Math.round(x); // x=10
1 for (int element : a)
2 System.out.println(element); // 输出数组a的每一个元素
1 GregorianCalendar calendar = new GregorianCalendar(year, month-1 ,day); //0默示一月
Eclipse source-Organize Imports // 具体导入
1 public boolean equals(Object otherObject) {
2 // a quick test to see if the objects are identical
3 if (this == otherObject) return true;
4
5 // must return false if the explicit parameter is null
6 if (otherObject == null) return false;
7
8 // if the classes dont match, they cant be equal
9 if (getClass() != otherObject.getClass())
10 return false;
11
12 // now we know otherObject is a non-null Employee
13 Employee other = (Employee) otherObject;
14
15 // test whether the fields have identical values
16 return name.equals(other.name)
17 && salary == other.salary
18 && hireDay.equals(other.hireDay);
19 }
1 public int hashCode() {
2 return 7 name.hashCode()
3 + 11 new Double(salary).hashCode()
4 + 13 hireDay.hashCode();
5 }
Error : 体系内部错误 或 资料耗尽
Exception:IOException 和 RuntimeException-由法度错误导致
ArrayIndexOutOfBoundsException-数组下标越界
NullPointException-变量为空




