String Rotation in Java - Write a Program to check if strings are rotations of each other or not

String based algorithmic questions are very popular in Java interviews e.g. checking if two String is the anagram of each other (see), or checking if given String is a palindrome (see), or just finding permutations of given String (see). One of such popular String based interview questions is about to check if two Strings are a rotation of each other in Java. In order to solve this question, you should know what is String rotation? Well, A string is made of characters and you just rotate the String around any character e.g. "programming" will become "ingprogramm" if we rotate the String on trailing character 3 times. A k-rotation on a string takes the trailing k characters of the string and attaches it to the beginning of the string in the same order. You can rotate the String either in the clock wise (right from the top) or anti-clockwise(left from the top). The string can also be rotated in one go e.g. "123456" will become "456123" if we rotate 456 to the left around character "3".

3 Spring Certification Books - Best of Lot, Must Read

Books, Study guides, and mock exams are some of the important resources to prepare for Spring certifications. In the last article, I have shared some of the best Spring certification guides for Spring Core and Spring web certifications and today I'll share some of the best books to learn Spring frameworks from the certification perspective. If you are preparing for Spring certifications then these books will help you to learn Spring better. It's also true that more and more experienced and intermediate Java developers have started preparing for Spring certifications to make themselves more marketable. In a challenging and competitive environment like today's, Spring is one the essential skills for Java developer. The Spring certifications make you valuable in the eye of employers and help you to get both job and career growth.

How to Sort Map by values in Java 8 using Lambdas and Stream - Example Tutorial

In past, I have shown you how to sort a HashMap by values in Java, but that was using traditional techniques of pre-Java 8 world. Now the time has changed and Java has evolved into a programming language which also has the power of functional programming. How can you take advantage of that fact to do your day to day task e.g. how do you sort a Map by values in Java using lambda expressions and Stream API. That's what you are going to learn in this article. It will serve two purposes, first, it will tell you a new way to sort a Map by values in Java, and, second and more important it will introduce you to essential Java 8 features like lambda expression and streams.

Top 5 Spring Certification Study Guides for Core, Web, and Enterprise Integration Exams

Ever since Pivotal has announced that Spring training is not mandatory for becoming Pivotal certified Spring developer, more and more experienced Java programmers, who have been using Spring for years are preparing for the exam. This is obvious because the expensive Spring training, which cost around 32000 USD in the USA and most of the western nations and around 50,000 INR in India was the biggest hurdle on getting Spring certified. Even though training is the best way to prepare for certification because it is totally focused on certification exam and you will cover all topics there, it is not affordable for most of the Java developers around the world. Now, the cost of Spring certification has just reduced to 200 USD from the whopping 3200 USD it cost earlier.

Can you make an abstract class/method final in Java?

No, you cannot make an abstract class or method final in Java because abstract and final are the mutual exclusive concept. An abstract class is incomplete and can only be instantiated by extending a concrete class and implementing all abstract methods, while a final class is considered as complete and cannot be extended further. This means when you make an abstract class final, it cannot be extended hence it cannot be used and that's why Java compiler throws a compile time error when you try to make an abstract class final in Java. In short, an abstract class cannot be final in Java, using both abstract and final modifier with a class is illegal in Java.

Solving org.springframework.beans.factory.BeanCreationException: Error creating bean with name X [Java Spring]

If you are using Spring framework in your Java application and getting this error during startup it means Spring is not able to initialize the bean X and add into its application context, Why? There could be multiple reasons e.g. a typo on spring bean name. Let's take a closer look at the stack trace to find out the real reason:

BeanInstantiationException: Could not instantiate bean class [X]: No default constructor found; nested exception is java.lang.NoSuchMethodException: X.()

Here X is the class, which is declared as Spring bean. The error clearly says that default constructor is not present in class X. By default, Spring will try to instantiate beans by calling the default or no-argument constructor and if it doesn't find the default, no-argument constructor then it is not able to initialize the bean and hence it throws the BeanInstantiationException during startup, the real reason is also appended into stack trace as NoSuchMethodException.