Java

Java main method is the entry point of any Java program. It’s the method that the Java Virtual Machine (JVM) calls to execute the program. In this tutorial, we’ll explore what the main method is, how it’s executed, and what the valid Java main method signatures are. We’ll also discuss some best practices for writing…

Read More Java Main Method: A Comprehensive Guide

class Vehicle { int maxSpeed = 250; public void printMaxSpeed() { System.out.println(“Max speed: ” + maxSpeed); } } class Car extends Vehicle { int maxSpeed = 300; @Override public void printMaxSpeed() { System.out.println(“Max speed: ” + maxSpeed); } } class Test { public static void main(String[] args) { Vehicle vehicle = new Car(); // upcasting…

Read More Upcasting Vs Downcasting in Java

String validation plays a crucial role in Java programming as it helps ensure the correctness and reliability of data processing. Strings are fundamental data types used to store text-based information, such as user inputs, file contents, or database values. However, these strings can often be empty, null, or contain only whitespace characters, which can lead…

Read More Check if a String is Null, Empty or Blank in Java

{ “firstName” : “John”, “lastName”: “Doe”, “gender”: “Male”, “state”: “Texas” } public class Person { private String firstName; private String lastName; private String state; // constructors, getters and setters } public class Person { private String firstName; private String lastName; private String gender; <<<< private String state; } import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class…

Read More Unrecognized field not marked as ignorable – Java Jackson

In this article, we will cover the basics of Aspect-Oriented Programming (AOP). You will learn how to use AspectJ to provide different AOP advices to Spring Boot applications to support cross-cutting issues like logging, profiling, caching, and transaction management and finally we will do a practical implementation to record user operations using Spring Boot AOP.…

Read More A guide to Spring Boot AOP to Record User Operations

In this tutorial, you will learn about JUnit5 Lifecycle methods. A Lifecycle Method is any method that is directly annotated or meta-annotated with @BeforeAll, @AfterAll, @BeforeEach, or @AfterEach. Let’s have a look at these annotations one by one. @BeforeAll When a method is annotated with @BeforeAll it means that the method should be executed before…

Read More A Guide to JUnit5 Lifecycle Methods