Create a Custom Exception in Java 1. Introduction In this tutorial, we’ll cover how to create a custom exception in Java. We’ll show how user-defined exceptions are implemented and used for both checked and unchecked exceptions. 2. The Need for Custom Exceptions Java exceptions cover almost all general exceptions that… Continue Reading java-new-custom-exception

Add Hours To a Date In Java 1. Overview Before Java 8, java.util.Date was one of the most commonly used classes for representing date-time values in Java. Then Java 8 introduced java.time.LocalDateTime and java.time.ZonedDateTime. Java 8 also allows us to represent a specific time on the timeline using java.time.Instant. In this tutorial,… Continue Reading java-add-hours-date

Polymorphism in Java 1. Overview All Object-Oriented Programming (OOP) languages are required to exhibit four basic characteristics: abstraction, encapsulation, inheritance, and polymorphism. In this article, we cover two core types of polymorphism: *static or compile-time polymorphism* and dynamic or runtime *polymorphism*. Static polymorphism is enforced at compile time while dynamic… Continue Reading java-polymorphism

Functional Interfaces in Java 8 1. Introduction This article is a guide to different functional interfaces present in Java 8, their general use cases and usage in the standard JDK library. Further reading: Iterable to Stream in Java The article explains how to convert an Iterable to Stream and why… Continue Reading java-8-functional-interfaces