Java Variables Interview Questions
Hello Developers, In this article, you will learn basics of java variables. If you are preparing for your first ever java interview, then you must go through all the questions mentioned in this article. It will definitely help you clear all your doubts related to java variables. After reading this article, you will be able to […]
Immutable class with mutable member fields in Java
Immutable class is a class which once created, it's content can not be changed. Immutable classes are good choice for HashMap key as their state cannot be changed once they are created. Objects of immuable classes are also thread safe as threads can not change the value of its fields once it is created. Creating a basic immutable class is very […]
Breaking Singleton using reflection and Enum Singleton
This is our fifth article in the series of Singleton Design Pattern. The purpose of the singleton class is to control object creation, limiting the number of objects to only one. In our previous articles, we have discussed how we can create Singleton Design Pattern in Single-threaded and multithreaded environment. We have also discussed how we can […]
Preventing Cloning in Singleton Design Pattern
This is our third article on Singleton Design Pattern. The purpose of the singleton class is to control object creation, limiting the number of objects to only one. In our previous two articles, we have discussed how we can create Singleton Design Pattern in Single-threaded and multithreaded environment. In this article, we will discuss how we can […]
Serialization and Singleton Design Pattern
This is our forth article in the series of Singleton Design Pattern Articles. The purpose of the singleton class is to control object creation, limiting the number of objects to only one. In our previous three articles, we have discussed how we can create Singleton Design Pattern in Single-threaded and multithreaded environment. We have also discussed how […]
Singleton Design Pattern Using Double Checked Locking
This is our second article in the series of Singleton Design Pattern. In this article, we will see different thread safe approaches for lazy Initialization Singleton Design Pattern like Using Synchronized getInstance() method, Double checked locking approach and Bill Pugh Implementation using Inner class. For navigating to the other articles on Singleton Design Pattern, please refer table of contents on the right […]
Java Method Overriding Interview Questions
In our previous article, we have discussed tricky programming questions based on method overloading. However, Method overriding programming questions are more interesting and requires depth understanding of the concept than that of method overloading. Before moving to programming questions, lets understand the basic concepts of method overriding. Method Overriding Using method overriding, child class can […]
Java Method Overloading Interview Questions
After interviewing large set of candidates, we have come to conclusion that most of them fail to satisfactory explain basic OOPs concepts like difference between abstraction and encapsulation, static binding vs dynamic binding, co-varient return types, access modifiers scoping and checked exception handling in method overriding and overloading. Even if they are able to explain it well, interviewer […]
Marker Interface Interview Questions
The interface in java is a mechanism to achieve abstraction and it is one of the most discussed topic in entry and mid level java developer interviews. In our previous articles, we have seen various interface related topics like Interface Evolution in Java, Difference between interface and abstract class and Functional interface in java 8. In this post, we are going to […]
What is magic number CAFEBABE in java class file?
Java Compiler compiles a java source code into bytecode and stores it into .class file which will then get executed by JVM. Everybody knows about it. But do you know each class file in Java starts with magic number CAFEBABE? compelling, isn't it? 😀 After reading this article, you will be able to answer below questions: […]