Disclosure: This article may contain affiliate links. When you purchase, we may earn a small commission.

Composite Design Pattern in Java [Real world Example]

Hello Java Programmers, if you want to learn about Composite Design patterns in Java, like how to implement Composite design pattern and when to use it then you have come to the right place. Earlier, I have shared the best Java design pattern courses and in this article, I am going to talk about Composite design Patterns, one of the 24 GOF patterns described in the classic Object Oriented design pattern book.  Composite Design Pattern is a behavioral design pattern from GOF, first described in their classic book design pattern. The composite pattern allows you to build a structure as a tree, which contains both leaf and composites

Top 50 Java 8 Stream, Lambda, and Functional Programming Interview Questions

Hello guys, if you are preparing for Java interviews and looking for some Java 8 Stream, Lambda Expression, and other Java 8 features then you have come to the right place. Earlier, I have shared 140+ Core Java interview questions and 20+ Spring Boot questions and in this article, I am going to share Stream, Lamba expression, and other Java 8 feature-based questions.  Java 8 features are now not remained as good to know features. They have been increasingly adopted by many organizations and most of the new development encourage developers to write code in Java 8 style to take full advantage of massive CPU power available in modern servers like HP 380 Gen 8 servers, also known as G8. 

How to find number of days between two dates in Java 8 [LocalDate until() & between() Example ]

You can use the LocalDate.between() method to find the number of days between two dates in Java. This method is full proof and takes care of date-time nuisances like leap year and daylight saving time. Before Java 8, it was really difficult to calculate the number of days between two dates in Java. Though old Date and Calendar API provides methods to compare two dates like equals(), before(), and after(), no method can tell the exact difference in days or months between two dates unless you are using the joda-time library. All that is over now. You can now do better date-time arithmetic using Java 8 Date and Time API.

Udemy vs Educative Review? Which is better Website for Beginners?

Hello guys, if you are wondering the difference between Udemy and Educative and whether you should take Udemy courses or join the Educative platform to learn new tech skills, you have come to the right place. Earlier, I have shared a comparison between Pluralsight and Udemy as well as CodeCademy vs Pluralsight in this article, I will compare Udemy with Educative, a new text-based, interactive learning platform. While I have often said that Udemy is my favorite platform because you can get high-quality and comprehensive courses from top instructors for just $9.9, which is phenomenal. 

Top 10 Java ClassLoader Interview Questions and Answers

Hello guys, if you are preparing for Java interviews and want to refresh your knowledge of Classloaders in Java then you have come to the right place. Earlier, I have shared Java interview questions on Collections, Multithreading, Serialization, and Generics, and in this article, I am going to share frequently asked Java interview questions about class loaders. If you don't know, a class loader is a program that loads classes in Java programs. The mechanism of class loading is very important to understand how the Java program works. When you run a Java program you give the name of the main class, from their onwards, built-in classloaders like Bootstrap classloader start loading not just the main classes but other Java library classes which is required to run that program. 

Why Java Developer Should Learn Maven or Gradle?

Hello guys, being a Java blogger, many Java developers ask me questions like "I am learning Java, should I also learn Maven or Gradle?" or "Is it mandatory to learn Maven to get a job as a Java developer", "Should I learn Maven or Gradle, which one is better for future?" and the less common one "Why should I learn Maven or Gradle as a Java developer?".  In the past, I have shared the best courses to learn Maven for Java developers and some useful Gradle books and courses,  as well as answered questions around Maven vs Gradle and I will try to answer these questions in this article and assert the importance of Maven and Gradle as a build tool for Java Developer.  Along the way, I will also share useful resources to learn both Maven and Gradle for Java developers. 

10 Essential UTF-8 and UTF-16 Character Encoding Concepts Every Programmer Should Learn

Hello guys, if you want to learn about character encoding, particularly UTF-18 and UTF-16, and looking for a good resource then you have come to the right place. In this article, I am going to discuss 10 important points about UTF-8 and UTF-16 character encoding which I believe every programmer should learn. This is one of the fundamental topics to which many programmers don't pay attention unless they face issues related to character encoding. Knowing how a character is stored and how they are represented is very important in this age of globalization where you need to store and work through data that contains characters from multiple languages. 

Java 8 IntStream Examples - range, rangeClosed, sum and sorted

Hello guys, if you want to learn about IntStream in Java 8 and looking for a simple tutorial and example then you have come to the right place. Earlier, I have shared 10 examples of Lambda expression and filter+ map+ collect examples and in this article, I will show you how to use IntStream in Java 8. IntStream is a specialization of Stream class for primitive int values. It allows you to perform a sequential and parallel aggregate operation on a list of values like count() to print the total number of element in stream, min() to find minimum value in the stream, max() to find maximum value in the stream, sum() to find a total of all values and average() to find the average of all numbers in the stream.

How to recursively list all files in a directory and sub-directory in Java

Hello, guys if you are looking for a Java program to recursively list all files in a directory or sub-directory in Java then you have come to the right place. Earlier, I have shared the best Java Programming courses and In this article, I will show you how you can use the SimpleFileVistor class from java.nio package to recursive list all files and directories inside a given directory. The API also provides you control over whether to list only files or directories when you are navigating recursively. This makes it very useful for archiving programs or creating build tools like Maven or any Java program which has to deal with files and directories. 

3 Examples to Generate Random Alphanumeric String in Java - UUID Example

Many times we need random alphanumeric String for one or another purpose and Thankfully Java provides a couple of ways to create random Strings which can be numeric, alphanumeric, or simply alphabetic. If you are familiar with Java API to generate random numbers like java.util.Random class and Math.random() method than It's quite easy to create an array with choice of characters like Alphanumeric, numeric, alphabets, special characters, and choose random characters to construct random String. If you like using an open-source library and happen to be using Apache commons-lang then generating an alphanumeric String is just one line of code as shown in the first example in our Java program. 

How View Resolver works in Spring MVC? [InternalResourceViewResolver Example]

Hello guys, if you are wondering what is view resolve in Spring MVC and what role InternalViewResolver class plays in Spring MVC then you have come to the right place. Earlier, I have explained to you how Spring MVC works internally and how it processes HTTP requests coming to your web application. One of the important parts of that processing was resolving views, which is handled by the ViewResolver interface, which is the V part of MVC. They are responsible for returning correct views to the client, both in the Spring MVC application as well as on REST APIs. In this article, you'll learn more about view resolvers in Spring MVC by explaining the InternalResourceViewResolver class. 

7 Interesting Tech Books For Experienced and Senior Developers to Read - Best of Lot

Hello guys, if you are looking for some interesting novel-style tech books to read this weekend then you have come to the right place. Earlier, I have shared the best software architecture books and in this article, I am going to share the best tech books for experienced developers to not just learn technical skills but also operational and management skills in a fun and easy way. I always like to read books which are interesting first and informative later because it's very difficult to go through a book which informative but not interesting and that's why when I found an interesting tech book which is full of life lessons, I buy it and read it again and again and this book list is collection of such books. 

Difference between @ContextConfiguration and @SpringApplicationConfiguration in Spring Boot Testing?

What is the difference between @ContextConfiguration and @SpringApplicationConfiguration is one of the frequently asked Spring Boot Testing interview questions which is often used to check if the candidate knows about how to unit test Spring boot application. Even though both @ContextConfiguration and @SpringApplicationConfiguration annotations are used along with SpringJUnit4ClassRunner to specify how to load the Spring application context, there is a subtle difference between them. Although @ContextConfiguration does a great job in loading application context it doesn't take full advantage of Spring Boot features. Spring Boot applications are ultimately loaded by either SpringApplication ( in the case of the JAR) or SpringBootServletInitializer