随笔分类 -  Java

摘要:Reference [1] Repost http://javabypatel.blogspot.com/2016/09/concurrenthashmap-interview-questions.html Question 1. What is the need of ConcurrentHash 阅读全文
posted @ 2018-07-23 17:01 小张的练习室 阅读(398) 评论(0) 推荐(0) 编辑
摘要:References [1] https://dzone.com/articles/how-analyze-java-thread-dumps The content of this article was originally written by Tae Jin Gu on the Cubrid 阅读全文
posted @ 2018-03-15 18:50 小张的练习室 阅读(276) 评论(0) 推荐(0) 编辑
摘要:工作中发现一个有意思的bug。Jenkins上测试UTF-8 解码文件的unit test莫名其妙的fail了,之前一直跑的好好的我们也没有改动任何代码。相关代码如下: 经过排查发现removeBlankLines(InputStreamReader in)方法内部对InputStreamReade 阅读全文
posted @ 2018-03-12 21:38 小张的练习室 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Try to inspect the memory leak in the following code: If a stack grows and then shrinks, the objects that were popped off the stack will not be garbag 阅读全文
posted @ 2018-02-14 07:39 小张的练习室 阅读(136) 评论(0) 推荐(0) 编辑
摘要:a &= b also means a = a & b true & true ==> true true & false ==> false false & true ==> false false & false ==> false true | true ==> true true | fal 阅读全文
posted @ 2018-01-23 06:56 小张的练习室 阅读(376) 评论(0) 推荐(0) 编辑
摘要:References: [1] http://rick-hightower.blogspot.co.uk/2014/04/which-is-faster-java-object.html [2] https://www.darkreading.com/informationweek-home/why 阅读全文
posted @ 2018-01-11 21:50 小张的练习室 阅读(167) 评论(0) 推荐(0) 编辑
摘要:References [1] http://java-questions.com/Serialization-interview-questions.html [2] http://javarevisited.blogspot.co.uk/2011/04/top-10-java-serializat 阅读全文
posted @ 2017-08-11 21:31 小张的练习室 阅读(284) 评论(0) 推荐(0) 编辑
摘要:AND 和 & num & 1 可以得到整数num二进制表达的最后一位。 Example: num & (1 << n)可以得到num从右向左第n+1位的bit 整数n, n&(n-1) 操作相当于把二进制表示中最右边的1变成0 XOR 异或 ^ 如果a、b两个值不相同,则异或结果为1。如果a、b两 阅读全文
posted @ 2017-06-26 04:31 小张的练习室 阅读(335) 评论(0) 推荐(0) 编辑
摘要:References [1] https://blog.csdn.net/u011974987/article/details/46866229 Java provides two different types/classes of Reference Objects: strong and we 阅读全文
posted @ 2017-06-24 07:24 小张的练习室 阅读(589) 评论(0) 推荐(0) 编辑
摘要:Output So the summary is: 0 < 9 < A < Z < a < z 阅读全文
posted @ 2017-06-15 23:01 小张的练习室 阅读(236) 评论(0) 推荐(0) 编辑
摘要:堆的形状是一颗完全二叉树 public class B { public static B t1 = new B(); public static B t2 = new B(); { System.out.println("构造块"); } void hi () { System.out.print 阅读全文
posted @ 2017-06-13 17:12 小张的练习室 阅读(653) 评论(0) 推荐(0) 编辑
摘要:Reference: [1] https://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string Ways to convert an InputStream to a String: Using IO 阅读全文
posted @ 2017-06-13 17:09 小张的练习室 阅读(231) 评论(0) 推荐(0) 编辑
摘要:Java中有两类线程:User Thread(用户线程)、Daemon Thread(守护线程)。 Daemon的作用是为其他线程的运行提供服务,比如说GC线程。其实User Thread线程和Daemon Thread守护线程本质上来说去没啥区别的,唯一的区别之处就在虚拟机的离开:如果User T 阅读全文
posted @ 2017-06-12 23:20 小张的练习室 阅读(180) 评论(0) 推荐(0) 编辑
摘要:Reference [1] http://netjs.blogspot.co.uk/2015/05/fail-fast-vs-fail-safe-iterator-in-java.html The collections which are there from Java 1.2 (or even 阅读全文
posted @ 2017-06-05 23:01 小张的练习室 阅读(438) 评论(0) 推荐(0) 编辑
摘要:Reference [1] http://jiangzhengjun.iteye.com/blog/652440 [2] http://blog.sina.com.cn/s/blog_6ee97c580100opvp.html [3] http://javarevisited.blogspot.co 阅读全文
posted @ 2017-06-05 06:28 小张的练习室 阅读(150) 评论(0) 推荐(0) 编辑
摘要:除了在硬件上增加告诉缓存之外,为了使得处理器内部的运算单元能尽量被充分利用,处理器可能会对输入代码进行乱序执行(Out-Of-Order Execution)优化,处理器会在计算之后将乱序执行的结果重组,保证该结果与顺序执行的结果一致,但并不保证程序中各个语句计算的先后顺序与输入代码中的顺序一致,因 阅读全文
posted @ 2017-05-27 05:38 小张的练习室 阅读(234) 评论(0) 推荐(0) 编辑
摘要:Reference: [1] http://www.cnblogs.com/langtianya/p/3868135.html [2] http://www.cnblogs.com/timecloud/p/6555868.html 1. 引用变量 根据上下文来确定存放位置:比如void func() 阅读全文
posted @ 2017-05-25 16:30 小张的练习室 阅读(517) 评论(0) 推荐(0) 编辑
摘要:Integer when processors were 16 bit, an int was 2 bytes. Nowadays, it's most often 4 bytes on a 32 bits system or 8 bytes on 64 bits system. Character 阅读全文
posted @ 2017-04-20 18:44 小张的练习室 阅读(201) 评论(0) 推荐(0) 编辑
摘要:Reference: [1] http://www.cnblogs.com/kevin2chen/p/6714214.html 当调用 java命令运行一个java程序时,会启动一个java虚拟机进程。同一个jvm的所有线程、所有变量都处于同一个进程里,都使用该jvm进程的内存区。 jvm进程终止, 阅读全文
posted @ 2017-04-19 19:08 小张的练习室 阅读(180) 评论(0) 推荐(0) 编辑
摘要:Reference [1] http://www.cnblogs.com/youxia/p/java007.html Byte stream and Character stream 在 Java 中如果要把流中的数据按字节来访问,就应该使用 InputStream 和 OutputStream,如 阅读全文
posted @ 2017-04-04 05:57 小张的练习室 阅读(167) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示