
Java
rocksword
这个作者很懒,什么都没留下…
展开
-
Difference between Association, Composition and Aggregation in Java, UML and Object Oriented Program
In Object-oriented programming, one object is related to other to use functionality and service provided by that object. This relationship between two object is known as association in object orien转载 2015-01-25 12:02:50 · 432 阅读 · 0 评论 -
Java exception handling best practices
This post is another addition in best practices series available in this blog. In this post, I am covering some well-known and some little known practices which you must consider while handling ex转载 2015-03-08 14:37:47 · 317 阅读 · 0 评论 -
Why wait, notify and notifyAll is defined in Object Class and not on Thread class in Java Read more
Why wait, notify and notifyAll is declared in Object Class instead of Thread is famous core java interview question which is asked during all levels of Java interview ranging from 2 years, 4years to q转载 2015-03-08 16:15:05 · 312 阅读 · 0 评论 -
Binary Semaphore Tutorial and Example
A semaphore is a counter that protects the access to one or more shared resources. In this tutorial, we will learn how to use the binary semaphore for controlling access to a shared resource by mu转载 2015-03-08 15:53:46 · 219 阅读 · 0 评论 -
10 JDK 7 Features to Revisit, Before You Welcome Java 8
It's been almost a month Java 8 is released and I am sure all of you are exploring new features of JDK 8. But, before you completely delve into Java 8, it’s time to revisit some of the cool features转载 2015-03-07 13:07:17 · 264 阅读 · 0 评论 -
Writing a deadlock and resolving in java
In this post, I will write a piece of code which will create a deadlock situation and then i will discuss that way to resolve this scenario.In my previous post, i written about Auto reload转载 2015-03-08 13:03:08 · 170 阅读 · 0 评论 -
10 Example of Lambda Expressions and Streams in Java 8
Java 8 release is just a couple of weeks away, scheduled at 18th March 2014, and there is lot of buzz and excitement about this path breaking release in Java community. One of feature, which is syno转载 2015-03-07 12:43:02 · 423 阅读 · 0 评论 -
String vs StringBuffer vs StringBuilder in Java
Difference between String, Stringbuffer and StringBuilderString is one of the most important classes in Java and anyone who starts with Java programming uses String to print something on console by转载 2015-03-06 17:55:34 · 241 阅读 · 0 评论 -
2 Examples to Convert Byte[] array to String in Java
Converting a byte array to String seems easy but what is difficult is, doing it correctly. Many programmers make mistake of ignoring character encoding whenever bytes are converted into a String or转载 2015-03-07 11:21:34 · 391 阅读 · 0 评论 -
Why not to use finalize() method in java
We all know the basic statement that finalize() method is called by garbage collector thread before reclaiming the memory allocated to the object. In this post, we will drill down more deeply into t转载 2015-03-08 13:12:19 · 284 阅读 · 0 评论 -
Top 10 Tricky Java interview questions and Answers
What is a tricky question? Well, tricky Java interview questions are those questions which has some surprise element on it. If you try to answer a tricky question with common sense, you will most like转载 2015-03-06 15:38:56 · 599 阅读 · 0 评论 -
Java Class Loader
Java ClassLoader loads a java class file into java virtual machine. It is as simple as that. It is not a huge complicated concept to learn and every java developer must know about the java class loade转载 2015-03-06 18:23:34 · 293 阅读 · 0 评论 -
Java Tip: When to use ForkJoinPool vs ExecutorService
The Fork/Join library introduced in Java 7 extends the existing Java concurrency package with support for hardware parallelism, a key feature of multicore systems. In this Java Tip Madalin Ilie demons转载 2015-03-07 15:14:25 · 527 阅读 · 0 评论 -
Top 10 tough core Java interview questions answers programming
tough core Java interview questions and answersWhat is tough core java interview question ? Why do people look for tough Java questions before going for interview? well I don't thing I need to answe转载 2015-03-06 15:38:09 · 256 阅读 · 0 评论 -
What are difference between wait and sleep in Java
Wait vs sleep in JavaDifferences between wait and sleep method in Java Thread is one of the very old question asked in Java interviews. Though both wait and sleep puts thread on waiting state, they转载 2015-03-06 17:57:23 · 265 阅读 · 0 评论 -
Java 1.5 Generics Tutorial: How Generics in Java works with Example of Collections, Best practices,
Java Generics TutorialGenerics in Java is one of important feature added in Java 5 along with Enum, autoboxing and varargs , to provide compile time type-safety. Generics is also considered to be on转载 2015-03-07 14:44:17 · 531 阅读 · 0 评论 -
Default, Defender or Extension Method of Java 8 with Example
Java 8 now allows you to add non-abstract method implementations to interfaces by utilizing the default and static keyword. Methods with default keyword are known as default methods or defender meth转载 2015-03-07 15:09:05 · 262 阅读 · 0 评论 -
Everything about Java 8
The following post is a comprehensive summary of the developer-facing changes coming in Java 8. As of March 18, 2014, Java 8 is now generally available.I used preview builds of IntelliJ for my I转载 2015-03-07 16:44:08 · 433 阅读 · 0 评论 -
Tiered Compilation
Gadzooks, time flies! Been too long since I blogged… no time for something deep so here’s another quicky brain dump.Azul Systems has been running HotSpot with a Tiered Compilation system since 200转载 2015-03-31 10:56:31 · 485 阅读 · 0 评论 -
An overview of memory saving techniques in Java
An overview of memory saving techniques in Javaby Mikhail VorontsovThis article will give you the general advices on memory consumption optimization in Java.Memory usage optimization is转载 2015-03-31 11:54:04 · 227 阅读 · 0 评论 -
Kill Java daemon
Java,Shell原创 2015-01-05 17:11:08 · 266 阅读 · 0 评论 -
Architecture of a Highly Scalable NIO-Based Server
ContentsThreading ArchitectureThe Reactor PatternComponent ArchitectureAcceptorDispatcherDispatcher-Level EventHandlerApplication-Level EventHandlerConclusionResourcesIf you are asked to w转载 2015-05-21 15:37:09 · 243 阅读 · 0 评论 -
Java NIO Tutorial
Read more http://tutorials.jenkov.com/java-nio/index.html转载 2015-05-21 14:18:21 · 201 阅读 · 0 评论 -
Understanding Java Garbage Collection
What are the benefits of knowing how garbage collection (GC) works in Java? Satisfying the intellectual curiosity as a software engineer would be a valid cause, but also, understanding how GC works转载 2015-05-04 10:05:27 · 217 阅读 · 0 评论 -
The Principles of Java Application Performance Tuning
This is the fifth article in the series of "Become a Java GC Expert". In the first issue Understanding Java Garbage Collection we have learned about the processes for different GC algorithms, about转载 2015-04-30 17:42:22 · 206 阅读 · 0 评论 -
全面理解Java中的String数据类型
1. 首先String不属于8种基本数据类型,String是一个对象。 因为对象的默认值是null,所以String的默认值也是null;但它又是一种特殊的对象,有其它对象没有的一些特性。 2. new String()和new String(“”)都是申明一个新的空字符串,是空串不是null; 3. String str=”kvill”; String s转载 2015-01-15 16:52:47 · 197 阅读 · 0 评论 -
Java Garbage Collectors
By jonthecollector on Feb 01, 2008I drew this diagram on a white board for some customers recently. They seemed to like it (or were just being very polite) so I thought I redraw it for your amusemen转载 2015-01-16 19:12:27 · 707 阅读 · 0 评论 -
JAVA中synchronized与static synchronized 的区别
通过分析这两个关键字的分析,我们可以理解java中锁的概念。一个是实例锁(锁在某一个实例对象上,如果该类是单例,那么该锁也具有全局锁的概念),一个是全局锁(该锁针对的是类,无论实例多少个对象,那么线程都共享该锁)。实例锁对应的就是synchronized关键字,而类锁(全局锁)对应的就是static synchronized(或者是锁在该类的class或者classloader对象上)。转载 2015-01-19 22:06:02 · 246 阅读 · 0 评论 -
理解StrongReference,SoftReference, WeakReference的区别
Java 中一共有 4 种类型的引用 : StrongReference、 SoftReference、 WeakReference 以及 PhantomReference (传说中的幽灵引用 呵呵), 这 4 种类型的引用与 GC 有着密切的关系, 让我们逐一来看它们的定义和使用场景 : 1. Strong Reference StrongReference转载 2015-01-22 23:56:50 · 506 阅读 · 0 评论 -
Java进阶10 内存管理与垃圾回收
整个教程中已经不时的出现一些内存管理和垃圾回收的相关知识。这里进行一个小小的总结。Java是在JVM所虚拟出的内存环境中运行的。内存分为栈(stack)和堆(heap)两部分。我们将分别考察这两个区域。 栈栈的基本概念参考纸上谈兵: 栈 (stack)。许多语言利用栈数据结构来记录函数调用的次序和相关变量(参考Linux从程序到进程)。在Java中,转载 2015-01-27 01:13:52 · 215 阅读 · 0 评论 -
JAVA虚拟机的生命周期
一个运行时的Java虚拟机实例的天职是:负责运行一个java程序。当启动一个Java程序时,一个虚拟机实例也就诞生了。当该程序关闭退出,这个虚拟机实例也就随之消亡。如果同一台计算机上同时运行三个Java程序,将得到三个Java虚拟机实例。每个Java程序都运行于它自己的Java虚拟机实例中。 Java虚拟机实例通过调用某个初始类的main()方法来运行一个Java程序。而这个main()转载 2015-01-27 00:50:03 · 253 阅读 · 0 评论 -
How to find middle element of LinkedList in Java in one pass
How do you find middle element of LinkedList in one pass is a programming question often asked to Java and non Java programmers in telephonic Interview. This question is similar to checking palindro转载 2015-03-18 15:55:04 · 436 阅读 · 0 评论 -
Making operations on volatile fields atomic
OverviewThe expected behaviour for volatile fields is that they should behave in a multi-threaded application the same as they do in a single threaded application. They are not forbidden to behav转载 2015-03-25 00:01:48 · 1292 阅读 · 0 评论 -
Java Memory Model
Table of ContentsThe Internal Java Memory ModelHardware Memory ArchitectureBridging The Gap Between The Java Memory Model And The Hardware Memory ArchitectureVisibility of Shared ObjectsRa转载 2015-04-21 19:25:06 · 225 阅读 · 0 评论 -
Shell运行Java程序
Java,Shell原创 2013-08-09 12:15:03 · 331 阅读 · 0 评论 -
Memory consumption of popular Java data types
This article will give you an overview of some popular Java data types memory consumption. This article follows An overview of memory saving techniques in Java article earlier published in this blog转载 2015-03-31 13:14:56 · 202 阅读 · 0 评论 -
StampedLock.tryOptimisticRead() and Invariants
On this post, we are going to talk about the dangers of using optimistic read-locks, namely, how sensitive they are to the invariants.One noticeable example of an optimistic read-lock, is the St转载 2015-03-09 13:20:05 · 538 阅读 · 0 评论 -
String.intern in Java 6, 7 and 8 – string pooling
This article will describe how String.intern method was implemented in Java 6 and what changes were made in it in Java 7 and Java 8.First of all I want to thank Yannis Bres for inspiring me to转载 2015-03-31 14:06:46 · 226 阅读 · 0 评论 -
Trove library: using primitive collections for performance
19 July 2014: article text cleanup, added a chapter on JDK to Trove migration.16 July 2012: original version.This article would describe Trove library, which contains a set of primitive coll转载 2015-03-31 11:59:33 · 300 阅读 · 0 评论 -
Difference between HashMap, LinkedHashMap and TreeMap
What is the difference between HashMap, LinkedHashMap and TreeMap in Java? I don't see any difference in the output as all the three has keySet and values. What are Hashtables?Map m1 = new HashM转载 2015-01-26 11:26:36 · 360 阅读 · 0 评论