`
kingquake21
  • 浏览: 262546 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
4.       有两张关联的表A、B   A:  id   acount  pay_id           B:   pay_id  B_acount              1     100      1                               1        0              2     200      2                               2        0              3     200      1                       要求,更新表B,使得B_acount的 ...
对于Dynamic Proxy的原理,很多地方都有介绍,里面最神秘的就是JVM会在运行时动态生成一个类,好奇心驱使,想看看这个生成的类的代码是啥样的。于是,跟踪到Proxy.newProxyInstance()中,发现生成代码的关键语句byte[] ProxyGenerator.generateProxyClass(String proxyname,Class[] instances),写了段代码来输出那个类文件,并得到反编译的结果 ----------IPerson .java----------- package cn.edu.tju.bme; public interface ...
局部内部类为什么只能访问final局部变量,对于成员变量却可以随便访问? public class OuterClass { private int memberField = 10; public void outerDo(){ final int localField = fromOther(); class InnerClass{ public void innerDo(){ memberField = localField; } }; } private int fromOther() { ret ...
\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 mark一下,使用eclipse内置的WTP开发调试web应用时,这个地址就是work directory,而不是在tomcat的安装目录下,也不是采用context文件的方式,而是全盘复制到上面的目录中
对于语法差别,很多文章都写了,就不再赘述了,这儿主要讲本质的差异 抽象类定义了其子类的核心特征和功能(is a),例如继承Thread通常表明该类“is a”线程 而接口只是定义了类的附加能力(-able/can-do),例如Runable表示可以单独运行的任务,但是并不是说该类is a线程;Comparable表示类具有比较的功能,但是并不是说该类"is a"比较器 如果需要为子类添加或修改默认的行为,此时应该选择抽象类,而不是接口 如果需要为不相干的类提供公共的功能,应该使用接口;如果建立的模型在层次上很接近,应该选用抽象类 Interface ...
1. 委托原则:当加载一个类时,首先会委托父加载器来加载 2. 可视化原则:子类加载器能看到父类加载器加载的所有类,但是反过来是不行的。同时,兄弟类加载器也看不到对方加载的类 3. 唯一性原则:如果一个类加载器加载了某个类,那么它的子类加载器是不会再加载该类了的。 Delegation Principle: If a class is not loaded already, the classloaders delegate the request to ...
ThreadPoolExecutor有三个参数是用来管理内部池的大小,分别是corePoolSize,maximumPoolSize,workQueue public void execute(Runnable command) { if (command == null) throw new NullPointerException(); for (;;) { if (runState != RUNNING) { reject(command); ...
其实它们从英文的名称上来理解会更加容易一点,注意两者英文中的撇号的位置 补码,two's complement,对于非负数x,我们用2w -x(这里只有一个2)来计算-x的w位表示; 反码,ones’ complement,我们用[111...1]-x(这里有很多1)来计算-x的反码表示。 [111...1]-x也可以写成(2w -1)-x=2w -x-1,也就是反码=补码-1,那么补码就可以通过反码+1来计算,而-x反码的二级制是很容易计算的,只需要将x的二级制取反即可,估计这也是为什么翻译成反码的原因吧
The original semantics forvolatile guaranteed only that reads and writes ofvolatile fields would be made directly to main memory, instead of to registers or the local processor cache, and that actions on volatile variables on behalf of a thread are performed in the order that the thread requested. ...
http://www.ibm.com/developerworks/library/j-jtp02244.html?S_TACT=105AGX52&S_CMP=cn-a-j Most programmers know that thesynchronizedkeyword enforces a mutex (mutual exclusion) that prevents more than one thread at a time from entering a synchronized block protected by a given monitor. But syn ...
JDK1.5.0的API文档里的描述: yield:Causes the currently executing thread object to temporarily pause and allow other threads to execute. sleep:Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. 根本无助于理解两者间的差别 线程的生命周期里有三个状态Runable、Blo ...
Lucas Lee的修正(这里是原帖): Java代码 public class LazySingleton { private int someField; private static LazySingleton instance; private static int hasInitialized = 0; private LazySingleton() { this.someField = new Random().nextInt(200)+1; // (1) } ...
http://www.english-at-home.com/grammar/if-sentences/ There are four main types ofifsentences in English, often called conditional sentences. These sentences are in two halves, with theifpart in one half and the other part where you can use words such ascan,will,may,might,couldandwould. If + pre ...
查看了一下HttpInvokerClientInterceptor类的源码,归类如下: Throwable |-RemoteAccessException (属于RuntimeException) |- RemoteConnectFailureException |-ConnectException |-ClassNotFoundException |- 其他RuntimeException |- 目标接口所抛出的异常,是InvocationTargetException.g ...
从IBM notes邮箱中得到的灵感,在收件箱的最左侧可以使用鼠标拖拽选择多封邮件,或者是拖拽取消多封邮件的选择,以及Ctrl-A全选所有邮件的功能,觉得很是方便,省去了在界面中添加全选按钮导致界面难看、不易布局的问题 public class MyDialog extends JDialog implements ListSelectionListener{ private boolean mousePressed ; private boolean anchorSelected ; private boolean ctrlA ; public MyDia ...
Global site tag (gtag.js) - Google Analytics