Java

Java ClassLoaders

The Java ClassLoader is integral part of Java Virtual Machine (JVM), and is responsible for finding and loading class files during runtime. We can also create our own custom class loader to extend the functionality of JVM. In this article, we’ll discuss about class loaders, how they work and the methods invoked during class loading process. What is a ClassLoader In Java, programmer written code is compiled into platform independent format, that is as a .class file. Each Java program consists of many individual .class files, each of which relates to a single Java class. These class files are not […]

Java ClassLoaders Read More »

Importance Of Overriding Equals And Hashcode Methods

In Java everything is an Object. Every class extends from class Object implicitly. The equals() and hashCode() are methods of Object class. These two methods works in conjunction with each other. The following sections explain why these methods needs to overridden and the effects of not overriding. Override equals() method The equals() method is used to compare two objects and returns a boolean value, which indicates whether the two compared objects are same in a meaningful way. We can also compare two objects using == (equality) operator, but this comparison results true only if both object references are referring to

Importance Of Overriding Equals And Hashcode Methods Read More »

Implementing Threads in Java

Before we get into thread implementation in Java, let us spend some time and understand the idea and concepts behind threads and concurrent programming. What is Concurrency Applications are expected to do more than one task at the same time in parallel. Applications which do more than one tasks at a time are called concurrent applications. An example of such concurrent software application is streaming audio application. It must read the digital audio from the network, decompress, manage playback and update the audio simultaneously. Process and Thread There are two basic units in the concurrent programming namely Process and Thread.

Implementing Threads in Java Read More »

Enumerated Data Types In Java

Enumerated data types (or enums for short) are newly introduced in Java 5.0. Enums will let us choose a value from a pre-defined list of values. Each value in this pre-defined list are called “enums”. Using enums we can restrict the values thus by reducing bugs in our code. Suppose, if we are developing payroll application, we need to have certain employee types. For example, permanent employee, contract employee, full time employee and part-time employee etc. In order to provide these employee types, we can create an enum with these pre-defined employee types as shown below: enum EmployeeType { PERMANENT,

Enumerated Data Types In Java Read More »

Differences Between JDK and JRE

If you are a Java developer, then knowing the common differences between JDK and JRE is a must. Differences between these two is often a well-known question and there is the probability of ending up in confusion when differentiating what is what. Also understanding these differences makes it easy for you to visualize things possibly in a logical manner. Well known the differences between JDK and JRE as one is a software development kit and the other is a bundle that allows for a java program. Java Development Kit (JDK): Java development kit or the JDK contains the tools required

Differences Between JDK and JRE Read More »

Covariant Return Types In Java

As we already know what method overriding is, the subclass providing new implementation of the super class method provided that the method signature in subclass should exactly match with method signature of super class including the return types. The covariant return types are newly introduced since Java 5.0, and used during method overriding. Covariant return type allows us to change the return type of the overriding method in the subclass; however this return type in subclass method must be a subtype of super class method return type. Also Check: Java Interview Questions and Answer Simply put, overriding method (in subclass)

Covariant Return Types In Java Read More »

What Is Just-in Time Compiler? Difference Between Compiler And Interpreter

The concept of Just-in Time Compiler is well known not only in Java but also in other languages like Ruby, .Net, C# etc., While JVM is a part of JRE; JIT is a part of JVM that is used to speed up the execution time of a program. JVM is the just-in-time compiler for Java that allows you to run programs written in Java as well as in many other high-level languages, such as Scala, JRuby, Python etc. The set of languages supported by JVM is combinedly known as JVM languages. We all know the basic definition of compiler as

What Is Just-in Time Compiler? Difference Between Compiler And Interpreter Read More »

How Does A Java Virtual Machine Works?

Even an amateur Java programmer knows that a given Java byte code is executed in Java Runtime Environment. JRE plays an important role in Java as it composes of Java APIs and JVM. Java Virtual Machine (JVM) is known for analyzing and executing the byte code of Java and it is not necessary to know, as a developer, how JVM works. But learning and understanding the architecture of JVM helps you to gain knowledge on the overall insight of a virtual machine. Not only Java, but Java Virtual Machine (JVM) also supports a set of languages which are high-level languages.

How Does A Java Virtual Machine Works? Read More »

Exception Handling

While writing a program, it is obvious that any abnormal condition may arise.By abnormal condition we mean, a condition that effects the normal execution of our code. When these conditions occur, the execution of our code is likely to stop. Generally, we refer this abnormal condition as an error. But to say it error every-time, is not correct. If our code is able to handle this weird condition, then we’ve to say it an exceptional condition or simply an exception. And the process to handle this exception is known as exceptional handling. Consider a scenario in which you have to

Exception Handling Read More »

Dynamic Binding

Java gave us many important concepts like Inheritance, which is used to create a hierarchy of classes. And while coding with inheritance, we encountered another concept which we call as Method Overriding. In method overriding, we have a method in the sub-class as well as in the super-class, both having the same name and return type. While overriding a method the problem was that, how the compiler would know which function is being referred, by the caller. Therefore, to deal with this, java gave us Dynamic Binding. Dynamic Binding refers to the concept where the compiler is unable to resolve

Dynamic Binding Read More »

Scroll to Top