getResourceAsStream与其它获取 InputString 方法的差异
摘要:getResourceAsStream:Finds the resource with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.The name of a resource is a '/'-separated path name that identifies the resource.This met
阅读全文
Class.forName("com.mysql.jdbc.Driver")
摘要:为什么实例化一个"com.mysql.jdbc.Driver"就可以注册Driver到DriverManager了呢?1 Class.forName("com.mysql.jdbc.Driver");2 conn = java.sql.DriverManager3 .getConnection(4 url,5 USERNAME, PASSWORD);这是com.mysql.jdbc.Driver的源码: 1 public class Driver extends NonRegistering...
阅读全文
异常记录
摘要:*调试总结:1、调试时因该F5(eclipse)沿着异常堆栈一步一步往上调试,而不只是预设一个断点。应对InvocationTargetException。JSP:date: 2011/10/31contents: 使用jsp代码段引入bean时,出现了莫名的异常。如下:View Code 1 public class Order 2 { 3 protected int id; 4 public Order() 5 { 6 } 7 8 public int getId() 9 {10 return id;11 }12 ...13 }14 15 public class Item16 {...
阅读全文
对象比较中equals 与 ”==“的差别
摘要:要点:1、String str1 = "1";与 String str2 = new String("1"); 在内存中的表现是不同的。2、str2 = str2.intern();可以消除这种(str1、str2)不同。3、"==" 表示引用对象的引用比较,或则值对象的值比较。虽然String是引用对象,但是String的比较不能单纯的通过"=="实现,因为如 "1、"。4、Integer intObj = 1;Integer intObj2 = 1;int intNative = 1;的eq
阅读全文
抽象类的抽象方法及使用
摘要:class:java.util.AbstractMapline:381public abstract class AbstractMap<K,V> implements Map<K,V> { * Sole constructor. (For invocation by subclass constructors, typically protected AbstractMap() { ... * {@inheritDoc} public Collection<V> values() { if (values == null) { valu...
阅读全文
嵌套类引用实例化的外部类的方法
摘要:class:java.util.HashMapline:814HashMap.this.removeEntryForKey(k) 1 public class HashMap<K,V> 2 extends AbstractMap<K,V> 3 implements Map<K,V>, Cloneable, Serializable 4 { 5 ... 6 final Entry<K,V> removeEntryForKey(Object key) {...} 7 private abstract class HashIterator<E&g
阅读全文
可叠加定义的成员变量的赋值及操作(权限)
摘要:/** * The int value representing the public * modifier. */ public static final int PUBLIC = 0x00000001; /** * The int value representing the private * modifier. */ public static final int PRIVATE = 0x00000002;
阅读全文
static method and instance
摘要:java.beans.EventHandler.EventHandler public static T create(Class listenerInterface, Object target, String action, String eventPropertyName, String listenerMethodName){...}
阅读全文
Adapter
摘要:java.awt.event.MouseAdapter
阅读全文
Qt中的跨线程调用
摘要:public class MainThread{ private void corssThreadInvoke(final String arg) { QApplication.invokeLater(new Runnable() { String arg_ = arg; public void run() { //TODO //如果需要调用全局变量, //就必须用方法来...
阅读全文
编码学习总结
摘要:一、ANSI二、Unicode三、UTF-8四、UTF-16五、ISO 8859-1六、JAVA中的编码格式Keywork: ANSI, GBK, UTF-8, Unicode, UTF-16, UTF-16LE, UTF-16BE, ASCII, ISO 8859-1, BOM, JAVA一、ANSI码(American National Standards Institute),美国国家标准学会的标准码。http://baike.baidu.com/view/1273097.htm在简体中文系统下,ANSI 编码代表 GB2312 编码,在日文操作系统下,ANSI 编码代表 JIS 编码。
阅读全文