摘要: 1. 值类型是存储在内存中的栈,而引用类型的变量在栈中仅仅是存储引用类型变量的地址来自堆,而其本身则存储在栈中。2. ==操作比较的是两个变量的值是否相等,3. 对于引用型变量表示的是两个变量在堆中存储的地址是否相同,即栈中的内容是否相同。Object: 1-----public native int hashCode(); 该方法返回的值一般是通过将该对象的内部地址转换成一个整数来实现的。 这样能保证每个对象的哈希码值不一样。 native:方法修饰符 ——(标志外部已实现) Native方法是由另外一种语言(如c/c++,汇编)实现的本地方法。 因为在外部实... 阅读全文
posted @ 2013-11-09 15:22 寻影 阅读(351) 评论(2) 推荐(0) 编辑
摘要: class Father{ public void fromFather(){ System.out.println("fromFather"); } }interface interfaceSon{ public void fromInterSon();}class Son extends Father implements interfaceSon { public void fromFather(){ System.out.println("fromFather2"); } public void formSon(){... 阅读全文
posted @ 2013-11-09 14:46 寻影 阅读(1926) 评论(0) 推荐(0) 编辑
摘要: Arrays.sort(a) 自定义排序,(需实现接口:Comparable)package com.hd;import java.util.Arrays;class Person implements Comparable{ int id ; int score ; public Person(int id,int score){ this.id = id; this.score = score ; } @Override public String toString(){ return "id:"+id+" sc... 阅读全文
posted @ 2013-11-09 14:39 寻影 阅读(591) 评论(0) 推荐(0) 编辑