Java

Java is a popular programming language that is used for a wide variety of applications, ranging from web development to mobile app development to machine learning. One of the features of Java that is particularly important for programmers to understand is the “final” keyword. The “final” keyword in Java is used to indicate that a…

Read More Java Final Keyword: A Comprehensive Guide

In Java, a static initializer block is a block of code that is executed when a class is loaded into memory. It is typically used to perform some initialization tasks that need to be done before the class can be used, such as initializing static variables, registering JDBC drivers, or building complex data structures. In…

Read More Mastering Java’s Powerful Static Initializer Block

public static void main(String[] args) { { System.out.println(“Summer”); } } { System.out.println(“Winter”); } 1 public class Car { 2 private String model = “Ford”; 3 4 { 5 System.out.println(“Instance Initializer block…”); 6 } 7 8 public Car () { 9 model = “Opel”; 10 System.out.println(“Constructor…”); 11 } 12 13 public static void main(String[] args) {…

Read More Java Instance Initializer Block

class Vehicle { void startEngine() { System.out.println(“Starting the engine…”); } void stopEngine() { System.out.println(“Stopping the engine…”); } } class Car extends Vehicle { void move() { System.out.println(“The car is moving…”); } void invoke() { super.startEngine(); move(); super.stopEngine(); } } class TestSuper2 { public static void main(String args[]){ Car car = new Car(); car.invoke(); } }…

Read More Keyword super in Java

In Java programming, the “this” keyword is used to refer to the current object. It is a reference to the object on which the method or constructor was invoked, and it is typically used to distinguish between class fields and local variables that have the same name. Understanding how to use “this” keyword is important…

Read More Java’s ‘this’ Keyword Explained: Why it Matters and How to Use It

In Java programming, the “static” keyword is used to define a class-level entity that can be accessed without the need to create an instance of the class. It is a powerful keyword that can be used to define static variables, methods, blocks, and classes. Understanding the concept of “static” is important for any Java programmer…

Read More The ‘static’ Keyword in Java: Everything You Need to Know

Java is an object-oriented programming language that uses the concept of objects and classes to represent real-world entities and their interactions. Understanding these concepts is essential for developing robust and scalable Java applications. In this tutorial, I will explain to you the fundamentals of objects and classes in Java, including their definition, creation, and usage.…

Read More Objects and Classes: A Guide to Excel in Java Programming

By following these naming conventions, your code will be consistent and easy to read, making it easier to collaborate with other developers and maintain your code over time. CamelCase in Java CamelCase is a naming convention that is commonly used in Java for naming variables, methods, and classes. It involves writing the first letter of…

Read More Mastering Java Naming Conventions for Superior Code

In this short tutorial, I am going to share with you how to switch your Spring Boot application, at runtime, to use a different logging level. Set Logging Level for a Package in Your App Suppose we have a Spring Boot Application with the following method in a Rest Controller class. @RestController @RequestMapping(“/users”) public class…

Read More Switch Logging Level in Spring Boot at Runtime

In this tutorial, you will learn how to use @AuthenticationPrincipal annotation to get the Jwt object containing the details of a provided in HTTP Request access token. When we send a request containing an access token in the Authorization header, behind the scenes,  Spring Framework will do a lot of work and if all is good,…

Read More @AuthenticationPrincipal – Getting the Jwt Claims

By default, Spring Boot RESTful web service endpoints consume and produce JSON representations. However, it’s possible to enable consuming XML and producing it for your REST API endpoints with minimal effort. This tutorial will guide you through the process of adding XML support to your Spring Boot application, allowing consuming XML and producing representations of…

Read More Consuming XML in Spring Boot REST

HATEOAS is a way to make your RESTful Web Service endpoint, automatically include links to other Resources of your API, in the response that it sends back to a calling client application.  The client application that consumes your web service endpoint, can then use those links, to consume other RESTful Resources that your Web Service…

Read More Add HATEOAS to Spring Boot RESTful Web Service