`
文章列表
首先Node的数据结构: static class Node<E> {         E item;         /**          * One of:          * - the real successor Node          * - this Node, meaning the successor is head.next          * - null, meaning there is no successor (this is the last node)          */         Node<E> next;  ...
下面是关于semaphore 的死锁的例子。主要自己学习thinking in java 上面的semaphore的例子的时候不仔细。结果将checkout()  和 checkin()  方法都加上了synchronized. 导致了死锁的问题。代码如下: public class SemaphoreDemo { final static int SIZE = 10; public static void main(String[] args) throws Exception { final Pool<Fat> pool = new Pool<>(Fat ...
对于java enum 静态方法的理解。仅供自己参考。仅作记录。发现自己更习惯将博客当做自己的笔记。所以对于他人的借鉴意义不是很大。不过自己不想为了分享而分享。 线索如下: package com.zhi.learnj2; import java.util.Date; import com.zhi.utils.DateUtil; public enum ConstantSpecificMethod { DATE_TIME { @Override public String info() { return DateUtil.format(new Da ...
java interface 中定义的class 是否是static ,记得书本上有详细的介绍,由于自己也不想再翻书,突然想到用javap 分别反编译一下interface和class 中包含的class 文件。两者进行对比消除了自己的疑惑。 记录下来仅仅是为了日后拾遗。所以也不想为了分享而分享。 package com.zhi.learnj2; public interface Food { class JackieZhi{ private String name; public JackieZhi(String name){ this.name = name ...
仅供自己参考。来自thinking in java 书籍案例,结合自己的尝试。主要记录自己的问题。 package com.zhi.learnj; import com.zhi.learnj2.Gender; public class EnumClass { public static void main(String[] args){ // Shrubbery that = Shrubbery.CRAWLING; // for(Shrubbery s: Shrubbery.values()){ // System.out.println(s.ordinal()); ...
代码仅供自己参考。 package com.zhi.learnj; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java ...
利用反射api  对class 的构造器进行查看,从而解决了自己对于默认构造器的访问权限的疑惑。 仅记录代码 public class ClassDemo { public static void main(String[] args){ Constructor<?>[] cntrs = ClassDemo1.class.getDeclaredConstructors(); for(Constructor<?> cntr : cntrs){ System.out.println(cntr); } } publi ...
关于java8api 中object graph 的解释,资料来自苹果ios 开发doc。供自己参考 In an object-oriented program, groups of objects form a network through their relationships with each other—either through a direct reference to another object or through a chain of intermediate references. These groups of objects are referred to as ...
package com.twodfire.alipay.utils; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import java.security.*; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X ...
package com.jackie; import java.util.*; /** * Created by zhimeng on 15/11/18. */ public class Countries { public static String[][] DATA = new String[][]{ {"China", "Beijing"}, {"Japan", "Tokyo"}, {"Taiwan", &q ...
Global site tag (gtag.js) - Google Analytics