JAVA 网上拾遗
public String makeStars(int size, char ch) {
if(size < 1) {
throw new IllegalArgumentException("size must be greater than 0");
}
char[] chs = new char[size];
for(int i = 0; i < size; i++) {
chs[i] = ch;
}
return new String(ch);
}
相关文档:
类的初始化和对象初始化是 JVM 管理的类型生命周期中非常重要的两个环节,Google 了一遍网络,有关类装载机制的文章倒是不少,然而类初始化和对象初始化的文章并不多,特别是从字节码和 JVM 层次来分析的文章更是鲜有所见。
本文主要对类和对象初始化全过程进行分析,通过一个实际问题引入,将源代码转换成 JVM 字节码后, ......
第二种方法效率更高
法①
Map map = new HashMap();
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object key = e ......
Caused by: java.sql.SQLException: ORA-00918: column ambiguously defined
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/ibatis/jpetstore/persistence/sqlmapdao/sql/Item.xml.
--- The error occurred while applying a parameter map.&nbs ......
1. 首先String不属于8种基本数据类型,String是一个对象。
因为对象的默认值是null,所以String的默认值也是null;但它又是一种特殊的对象,有其它对象没有的一些特性。
2. new String()和new String(“”)都是申明一个新的空字符串,是空串不是null;
3. String str=”kvill”;
......
Java中连接数据的Hibernate
配置
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.s ......