






















If the JDBC API is not able to locate the JDBC driver, it will throw a SQLException. If there are jars for the drivers available, they need to be included in the classpath to enable the JDBC API to locate the driver
ResultSet一开始游标指向的是第一条前面,所以必须运行.next()拿到第一条
RowSet是种特殊的支持JavaBean组件的ResultSet
JdbcRowSet:
CachedRowSet: disconnected ResultSet
WebRowSet: CachedRowset + XML (没有说这个是JSON格式喔)
JoinRowSet: WebRowset + SQL join
FilteredRowSet: WebRowset + filtering
JDBC 4.1 introduces the capability to use try-with-resources statement to close resources (Connection, ResultSet,and Statement) automatically.
try-catch的异常如果类似而且处理方式也类似的话,可以考虑使用multi-catch块
即使在catch中return了,也还是会执行到finally的,除非执行的是system.exit(n), 因为这个是停掉所有包括其它的
static initialization block cannot throw any checked exceptions. now-static initialization blocks can. however, all the constructors should declare that exception in their throws clause
重写的方法中throw的异常只能比父类的异常更具体,而不能更宽泛,或者不throws也是可以的
如果方法在实现的多个接口中都存在且抛出的异常不同,则实现的方法应该同时抛出这些异常
自定义exception最后继承于Exception或RuntimeException,而不要直接继承Throwable,这个是JVM预留的
bundlename_language_country_#script.properties
Format (抽象类)
NumberFormat
DateFormat - 大写W/D/F(day of week)的是in year, 小写w/d/f的是in month,大写S是毫秒,大写K是am/pm小时数,小写k是hour (1-24), H是(0-23)
SimpleDateFormat
sleep(): 不会release the lock,会hold on to the lock
join(): wait for another thread to terminate
仍然不懂的:
static method 不可以被override
接口里的方法只能为public & abstract,否则会出编译错“Illegal modifier for the interface method say; only public & abstract are permitted”
接口里面的field只能为public, final & static,否则会出编译错“Illegal modifier for the interface field Foo.iVisual; only public, static & final are permitted”
前期绑定和后期绑定
static block: A constructor will be invoked when an instance of the class is created, while the static block will be invoked when the program initializes
接口内部类自动都是public static的,相当于为接口定义了一种变量类型
System.out.println(et.TEST2); // et定义为一个静态类的常量后,仍然可以用et.TEST2来取到TEST2的常量
因为enum是final static public的,所以不能定义在local inter class中
FileWriter fw = FileWriter(path, boolean isAppend)
fw.append("test001");
fw.close();
如果没有第二个boolean参数,默认为覆盖写。
A setAutoCommit (False) method invocation starts a transaction context.
看一下正则表达式
\\s* matches 0 or more occurrences of whitespaces.
ScheduledExecutorService
The method used to obtain the Executor determines how many Threads are used to execute tasks.
看集合类图,象Q144
Class Hashtable extends Dictionary implements Serializable, Cloneable, Map。
Interface SortedMap extends Map
Change FileReader to BufferReader.
public class BufferedReader extends Reader
Read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.
The buffer size may be specified, or the default size may be used. The default is large enough for most purposes.
ThreadLocalRandom.current().nextInt(1, 101);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。