Java
-
OOP in Java: Classes, Objects, Encapsulation, Inheritance and Abstraction
Java is consistently one of the world’s top three most popular languages. Its adoption in fields like enterprise software development, Android mobile apps, and large-scale web applications is unmatched. Its strong type system, extensive ecosystem, and “write once, run anywhere” capability make it particularly appealing for building robust, scalable systems. In this article, we’ll explore how Java’s object-oriented programming features enable developers to harness these capabilities effectively, allowing them to build maintainable and scalable applications through proper code organization and…
-
How to Use Design Patterns in Java with Spring Boot – Explained with Code Examples
As software projects grow, it becomes increasingly important to keep your code organized, maintainable, and scalable. This is where design patterns come into play. Design patterns provide proven, reusable solutions to common software design challenges, making your code more efficient and easier to manage. In this guide, we’ll dive deep into some of the most popular design patterns and show you how to implement them in Spring Boot. By the end, you’ll not only understand these patterns conceptually but also…
-
How to Implement Fine-Grained Authorization in Java and SpringBoot
Securing your application goes beyond simply granting or denying access at the surface level. As a developer, you need to implement fine-grained authorization (FGA) to manage permissions at a more detailed, granular level. FGA allows you to set up detailed access controls that specify who can do what and under which conditions. In this tutorial, you will learn how to implement fine-grained authorization in Java and Spring Boot using Permit.io. Here is the source code (remember to give it a…
-
What are the SOLID Principles in Java? Explained With Code Examples
In this article, you’ll learn about the SOLID principles. You’ll gain an understanding of each principle along with Java code examples. SOLID principles are a set of five design principles used in object-oriented programming. Adhering to these principles will help you develop robust software. They will make your code more efficient, readable, and maintainable. SOLID is an acronym that stands for: Single Responsibility Principle Open/Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle Single Responsibility Principle The single…
-
How Java HashMaps Work – Internal Mechanics Explained
A HashMap is one of the most commonly used data structures in Java, and it’s known for its efficiency. Data in a HashMap is stored in the form of key-value pairs. In this article, I will introduce you to HashMaps in Java. We will explore the common operations of HashMap and then delve into how it operates internally. You will gain an understanding of the hash function and how index calculation takes place. Finally, we will look at the time…
-
Java Convert double to String
Today we will see different ways to convert double to string in java. Java double to string conversion can be done in many ways, we will go through them one by one with example code snippets. Java Convert Double to String Let’s look at different code snippets for java double to string conversion. Note that double is a primitive data type whereas Double is an Object. However java supports autoboxing, so they both can be used interchangeably in most of…
-
Java Exception Interview Questions and Answers
Java provides a robust and object-oriented approach to handle exception scenarios known as Java Exception Handling. Sometime back I wrote a long post on Exception Handling in Java and today I am listing some important Java Exceptions Questions with Answers to help you in interviews. What is an Exception in Java? What are the Exception Handling Keywords in Java? Explain Java Exception Hierarchy? What are the important methods of Java Exception Class? Explain Java 7 ARM Feature and multi-catch block?…
-
JavaMail Example – Send Mail in Java using SMTP
Today we will look into JavaMail Example to send email in java programs. Sending emails is one of the common tasks in real life applications and that’s why Java provides robust JavaMail API that we can use to send emails using SMTP server. JavaMail API supports both TLS and SSL authentication for sending emails. JavaMail Example Today we will learn how to use JavaMail API to send emails using SMTP server with no authentication, TLS and SSL authentication and how…
-
Log4j2 Example Tutorial – Configuration, Levels, Appenders
Welcome to the Apache Log4j2 Example Tutorial. If you ask an expert developer about the most annoying thing about an application, the answer might be related to logging. If there is no suitable logging in an application, maintenance will be a nightmare. Most of the application go through Development testing, unit testing, integration testing. But when it comes to production, you will always face unique scenarios and exception. So the only way to figure out what happened in a specific case is…