interrupt(), interrupted() and isInterrupted() in Java Multithreading
In this post, we will understand about interrupt(), interrupted() and isInterrupted() methods in Java Multithreading. If you are interested in reading more about interruption mechanism you can look into our post InterruptedException in Java Multithreading. In Java, thread starts its execution when we call start() method on Thread object. It internally calls overridden run() method. Thread is said to be terminated when […]
Default Method In Interface | Java8
In this article, we will discuss Default Method in interface which was introduced from Java8. This feature allows developer to add new methods to the interfaces without breaking the existing implementation of these interface. It provides flexibility to allow interface to define implementation which will will be used when concrete class does not provide an implementation […]
CountDownLatch in Java Concurrency Utilities
CountDownLatch in Java Concurrency is a type of synchronizer which allows one Thread to wait for one or more Threads before it starts processing. You can implement the same functionality using wait() & Notify() mechanism but it requires lot of code and getting it write in first attempt is tricky, With CountDownLatch it can be done in […]
How does HashMap work internally in Java?
How does HashMap work internally in java is one of the most asked core java interview questions. Most of the candidates do not give the satisfactory explanation. This question shows that candidate has good knowledge of Collection. So this question should be in your TO-DO list before appearing for the interview. There are four things we should […]
Builder Design Pattern
Builder design pattern is a creational design pattern like Factory Pattern and Abstract Factory Pattern. For better understanding of any design pattern, You should know the problems faced by programmers before that design pattern was introduced. What are the traditional ways of creating an object of a class? We can provide either constructor or a static factory method to get the object of […]
How to create Immutable Class in Java
Immutable class is a class which once created, it's contents can not be changed. In other words, Immutable objects are the objects whose state can not be changed once constructed. In Java, String and all the wrapper classes e.g. Boolean, Integer, Long, etc are immutable classes. We can also create our own immutable class. Why should we write Immutable Classes? Here are […]
Java8 Features
Java 8 is released in March 2014. In this article, we will look into some of the java 8 features with examples. You can download JDK 1.8 from here based on your OS Platform requirements. We are going to cover below important features of the Java8: Lambda Expressions Functional Interfaces Stream Collection Type Interface Default […]
Functional Interface | Java8
In this article, we are going to discuss about one of the Java8 feature: Functional Interface. Java 8 is released in March 2014. You can download JDK 1.8 from here based on your OS Platform requirements. Java developer around the world frequently uses the Runnable, Comparator, Callable etc. One common thing about the above mentioned interfaces […]