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. 

Top 35 Python Interview Questions and Answers for Beginners [ 1 to 2 Years Experienced]

Hello guys, if you are preparing for a Python developer job and looking for some frequently asked Python interview questions then you have come to the right place. Earlier, I have shared the best books and best courses to learn Python and in this article, I am going to share 35 Python questions, covering different concepts for Python developer interviews. Sitting in any interviews, especially in tech interviews, is a tough job itself. You can't go in without proper preparation. Even if you have taken or given dozens of interviews, it is always recommended to go through the quick preparation notes or concepts.

Fibonacci Series with Memoization in Java 8 using ConcurrentHashMap as Cache [Example]

Hello guys, if you are wondering how to solve the Fibonacci series problem with memorization in Java then you have come to the right place. In the past, I have shared recursive and iterative Fibonacci series solution and in this article, I am going to show you how you can improve your solution using a technique called memorization which uses a cache to store the intermediate results. This is a very useful technique to solve Dynamic Programming problems like the Knapsack problem. The good thing about Java is that it provides rich libraries which have classes like ConcurrentHashMa which can be used as a cache to store these intermediary results instead of recomputing them. This can drastically reduce the time to calculate the Nth Fibonacci number.

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 thinking what is difference between Udemy and Educative, and whether you should take Udemy courses or join the Educative platform to learn new tech skills then you have come to the right place. Earlier, I have shared a comparison between Pluralsight and Udemy as well as CodeCademy vs Pluralsight and in this article, I am going to 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. 

Difference between Statement vs PreparedStatement vs CallableStatement in Java

Hello Java programmers, if you are looking to find out the difference between Statement, PreparedStatement, and CallableStatement in Java then you have come to the right place. Earlier, I have shared common JDBC Interview Questions and in this article, I am going to explain what is the real difference between these Statement types in Java and when to use Statement, PreparedStatement, and CallableStatement in Java programs. JDBC API provides several classes and interfaces for various things, but three of the most important types of Statement classes are Statement, PreparedStatment, and CallableStatement. They are designed to execute different types of SQL queries. 

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.

Top 50 SQL and Database Phone Interview Questions Answers

Database and SQL is a very important skill, not just for DBA or Database admins but also for any application developer like Java.NET, or Web developers. This is why you would often see questions from SQL and Database in Programming interviews. For DBAs, SQL is more important than a programmer, because it being their primary skill, they are also expected to know more than a common Java or .NET developer. Since no Java interview is just about Java questions, many times I receive a request from my reader about SQL questions like how to solve a particular query or some tricky questions based upon database indexes.

Top 40 Object Oriented Programming [OOP] Interview Questions Answers in Java

OOP Interview questions or Object-oriented programming and design interview question are an integral part of any programming job interviews like Java, C++, or C#. Since Java is an Object-oriented programming language, it's expected from Java developers that he is good at Object-oriented analysis and design and familiar with essential OOP concepts like Abstraction, Encapsulation, and Polymorphism. Object-Oriented Programming Interview question in Java is mainly based around fundamental OOP concept and how those are implemented in Java, like Abstraction OOP concept is implemented using an interface and abstract class, Encapsulation is using private keyword, etc.

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. 

5 Ways to Find length of String in Java without built-in length() method

On another day, someone asked me, is there a way to find the length of String without using the length() method from java.lang.String class? I didn't ask why, because I know it might have been asked to him on Interviews. Before I explore ways to find the length of String, let's recap what does the length of String means in Java? Well, it's no different than C here, a number of characters in a String including whitespace, newlines are known as length of String. By knowing this, you can think of many approaches to calculating length e.g. getting a char array from String and counting a number of characters or many are by applying some clever tricks.

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. 

Top 20 Spring MVC Interview Questions with Answers for Java Web Developers

The Spring MVC framework is one of the most popular Java frameworks for developing web applications. If you have been working in Java and developing web-based applications then there is a good chance that you have already used Spring MVC in your project. In the last decade, it has become the de facto framework for developing Java web applications. Spring MVC is based on a classic MVC (Model-View-Controller) design pattern but it is much more than that. It leverages, Spring framework's strength in terms of dependency injection and Inversion of control and promotes loosely coupled architecture, similar to the Spring framework itself. Because of its immense popularity and usefulness, most of the Java development job requires a good knowledge of Spring and Spring MVC.

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