随笔分类 - JAVA
摘要:Java中内部类使用场景:1、隐藏实现 当一个类单独出现的时候,是不能以private,protected关键字修饰的,但是作为内部类出现的时候,是可以加这类关键字修饰,所以,内部类第一个作用,就是隐藏实现,参见代码:public interface InterfaceA{ public void f();}public class InnerClassExam1{ private class InnerClass implements InterfaceA{ public void f(){ System.out.println("Inner...
阅读全文
摘要:生产异常日志:java.lang.IllegalStateException: Queue full原因:当使用add方法的时候,队列满了,再放入元素,就会报这个异常解决方法:将add方法替换成put方法,队列变成阻塞队列。引用java doc:BlockingQueue methods come in four forms, with different ways of handling operations that cannot be satisfied immediately, but may be satisfied at some point in the future: one
阅读全文
摘要:dom4j解析xml字符串中包含转义字符,解决方法:org.apache.commons.lang.StringEscapeUtils.unescapeXml(String xml)org.apache.commons.lang.StringEscapeUtils.escapeXml(String xml)引入commons-lang-2.3.jar到classpath
阅读全文

浙公网安备 33010602011771号