One of the most hyped question on Singleton pattern and really demands complete understanding to get it right because of Java Memory model caveat prior to Java 5. If a guy comes up with a solution of usingvolat
One of the most hyped question on Singleton pattern and really demands complete understanding to get it right because of Java Memory model caveat prior to Java 5. If a guy comes up with a solution of usingvolatile keywordwith Singleton instance and explains it then it really shows it has in...
Java is known for its simplicity of code, adding the concept of pointers will be contradicting. Moreover, since JVM is responsible for implicit memoryallocation, thus in order to avoid direct access to memory by the user, pointers are discouraged in Java. ...
there was no auto resource management and we should explicitly close the resource. Usually, it was done in thefinallyblock of a try-catch statement. This approach used to cause memory leaks when we forgot to close the resource.
即使当前内存空间不足,JVM也不会回收它,而是抛出 OutOfMemoryError 错误,使程序异常终止。如果想中断强引用和某个对象之间的关联,可以显式地将引用赋值为null,这样一来的话,JVM在合适的时间就会回收该对象 软引用 在使用软引用时,如果内存的空间足够,软引用就能继续被使用,而不会被垃圾回收器回收,只有在内存不足...
Garbage collection is one of the most important feature of Java. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. User program cann't directly free the object from memory, instead it is the jo...
Looking forward to appear in Java Interview, here are the key Java Interview Questions with Answers only for you. - aatul/Java-Interview-Questions-Answers
[Interview Question ][Data Structure] Two Sum Problem -Array Two sum problem is one of the most asked data structure questions for a java developer interview. There could be one or more ways to solve the problem but i am trying to give the optimized solution to this problem. Lets first...
How do Classes use memory in Java? How do you handle exceptions in Java? Here are some Java OOPs Interview Questions to crack coding interviews. Functions and Methods OOPs Interview Questions on Java Go through these Object-Oriented Programming interview questions on Functions and Methods to nail ...
http://ifeve.com/java-multi-threading-concurrency-interview-questions-with-answers/ volatile 的原理,作用,能代替锁么。 Volatile利用内存栅栏机制来保持变量的一致性。不能代替锁,其只具备数据可见性一致性,不具备原子性。 http://blog.csdn.net/gongzi2311/article/details/20715185 ...