Top-150 Spring Interview Questions

This is the 3rd part of Java Interview Questions series. 1st part is Core Java Interview Questions, 2nd part is Hibernate Interview Questions. Spring interview questions is an important part of Java developer interview preparation. As I said in 2nd part – Spring and Hibernate is a jentleman set of Java programmer. I’ve divided questions … Read more

How To Write Simple In-Memory Cache in Java Tutorial

I want to show you my implementation of lightweight and simple in-memory key-value cache mechanism in Java. Database queries could take a time and it’s a good idea to store frequently used data in the cache to retrieve it faster. Java caching frameworks like Spring Cache allows to define your own in-memory cache implementation, so … Read more

How to Split String in Java

I think you will agree that split a string in Java is a very popular task. Usually, you need to cut a string delimiter and parse other string parts into an array or list. I’ll explain to you 5 the most popular methods how to split a string in Java.How to Split String in Java: … Read more

Random Number Generator in Java

Generating random numbers in Java is a common task. It’s frequently used in gambling, cryptography, statistical sampling and other areas where you need to simulate unpredictable behavior. I’ll explain to you how to create random number generator and show few a little bit different ways how to do that. How To Generate Random Range in … Read more

Declaring Constants in Java

Constant in programming is a variable that never changes. Today I’ll tell you about declaring constants in Java. Java doesn’t have a special keyword to define a constant. const is reserved keyword (you can’t use it as a name of a variable for example), but it’s unused. So to declare a constant in Java you … Read more

How To Install, Update And Uninstall Java on Windows, MacOS and Ubuntu

In the scope of this article, I’ll explain to you how to install Java, how to update Java version and how to uninstall Java completely for 3 the most popular operating systems: Windows 10, MacOS, and Ubuntu. Install Java Installation guides include: Download JDK (32 or 64 bit) for your OS (Windows, MasOS, Ubuntu) Visual … Read more

How to Reverse a String in Java

Reverse a string in Java is a quite easy task. I’ll provide you 6 pieces of Java code to reverse a string. I think StringBuilder.reverse() and StringBuffer.reverse() are the best string reverse functions in Java. It’s already optimized, looks simple and easy. But sometimes you have a task to implement string reversal using for loop, … Read more

Exception Handling in Java

Java Exceptions is a language tool to react to exceptional cases (errors) in the runtime. In other words, if something went wrong you can throw or catch an exception. Let’s take a look at the exception hierarchy in Java: On the top is Throwable. It’s a superclass for each exception and error in Java. It … Read more