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

How to use Lombok in Java? Lombok @Data and @NonNull Annotations Examples

Hello Java programmers, if you have been doing professional Java development, you may have heard about Lombok library, one of the most popular Java libraries among professional Java developers, making coding in Java much more fun and rewarding. Java has always been criticized for its verbosity, and many programming languages like Scala and Groovy are invented to solve that problem, but Lombok solves that problem in Java itself. This means you don't need to learn a new programming language, but you can use the Lombok library and its annotations to write clear and concise code in Java. 

How to use NamedQuery in Spring Framework JDBC? Example Tutorial

Hello guys, many people don't know that Spring Framework provides support for NamedQuery where you can pass parameters in a much readable way by using named placeholders than the default placeholder of ? (question mark) which is used with PreparedStatement in Java. If you want to learn Spring JDBC then you have come to the right place. In the past, I have shared the best Spring Framework courses, books, and tutorials to learn Spring Framework and its different features, and in this example, I will show you how to use NamedQuery in Spring Framework. You can then use this technique to write much more readable queries on the Java layer for your application. 

10 Data Structures Every Programmer Should Learn

Data Structure and Algorithms are two pillars of Programming. They are also the most important ingredient of a good program and right choice of Data Structure and Algorithms can improve performance drastically, whereas a wrong choice can spoil the party, but do you know what exactly they are? Well, Data Structure are nothing but a way to store data, while Algorithms are ways to operate on that Data. There is a reason why Data Structure and Algorithms are taught in every single Computer Science classes, it doesn't matter whether you are learning Java, C++, Python, JavaScript, Golang, or any other programing language, those data structure and algorithm will be same everywhere. 

How to upload/download file in Spring MVC and Spring Boot Java application? Example Tutorial

Hello guys, if you are wondering how to upload file and download files from a Spring MVC application then you have come to the right place. This is an important functionality for any real-world application and knowing how to upload a file in a Spring application is important for professional Java developers and that's what you will learn in this Spring MVC tutorial. Earlier, I have shared several Spring Boot tutorial like Spring Boot + Microservices, and Spring Boot + REST and even  how to upload files using Servlet and JSP using Apache Commons FileUpload library and In this tutorial, we are going to discuss how to upload and download files using Spring MVC. 

How to use Mockito to Unit test Java Program with JUnit? Example Tutorial

Hello guys, if you are writing unit test your Java application then you would have definitely come across JUnit and Mockito, two of the essential unit testing framework  for Java developers. While JUnit offers support to run your test, setup and teardown and also assertion to check the expected and actual output. Mockito complements JUnit by offering you a mock based testing approach. Mock is nothing but a test double which can return a configured value when a certain method is called. It also provides ability to check if a particular method is called or not. By using Mock object or test double you can check if your code is behaving properly or not in different scenarios. This is also the key difference between JUnit and Mockito, JUnit provides infrastructure to run your test while Mockito provide infrastructure to created Mock objects. 

How to Enable log SQL statements in Spring Boot? Example Tutorial

Hello guys, if you are a Java developer developing Spring Boot applications, you may need to have proper knowledge of various kinds of errors and also how to overcome those. For example, most of Java developers use JPA in spring boot to make our work easy when managing databases. If you get an error like an internal server error (504 error), you need to go through your backend system and find the error. In many cases, these errors are caused by running invalid SQL or due to error on database. At that time, you often need to know which SQL statements are executed by Hibernate or JPA, or any other database library you are using.  

How to choose Collection in Java? List, Set, Map, and Queue Example

The Java collection framework offers implementation of different data structure like an array, list, set, map, queue, tree, etc and the choice really depends upon the situation and properties of the different data structure. For example, if your requirement is fast search with index then you can use ArrayList and if you want to store key-value pairs then you would consider using hash table data structure and there are a couple of implementation of hash table data structure in Java, like HashMap, Hashtable, LinkedHashMap, TreeMap, and ConcurrentHashMap. Now, which one will you choose? If you don't know or confused don't worry, I will give you a set of rules and use cases which will help you choose the right Collection type in Java depending upon scenario. 

Top 10 Matrix Coding Exercises for Programming interviews and Homework

Hello guys, if you are preparing for Coding interviews and solved 100+ data structure problems then you may know that Matrix is one of the under-rated topic for coding interviews but Matrix coding problems are not that easy to solve and  In this article, we'll see some of the popular Matrix coding problems for coding interviews. I actually learned a lot by solving Matrix related problems. I still remember the first Matrix based problem I solve was about how to multiply two matrices in Java and I learned a lot about multi-dimensional array and nested loop in Java by solving that problem. The second problem I solved was about transposing Matrix and that was also quite challenging for me at that time but helped me to further solidify my knowledge about loops and array in Java. 

How to find first recurring or duplicate character in given String? [Solved]

Hello guys, while surfing the Internet for a couple of weeks back, I come to know that this problem was asked on Google interviews, find the first recurring character in a given String. I don't know if that's true but this looks like a very simple coding problem from Google's Interview standard. If it was indeed asked, then that guy must have been very lucky. Anyway, I liked this coding problem and thought to write about it, because it's a good coding problem to check candidates' data structure and algorithms skills because it's tricky. It's tricky because it's very easy to make a mistake assuming just one recurring character in String, which you should avoid. Even if it was not asked on Google, you will potentially find this problem on various startups, and other IT companies like Infosys, TCS, Cognizant, Microsoft, and maybe Amazon

Difference between CAST, CONVERT, and PARSE SQL Server? Example Tutorial

Though all three, CAST, CONVERT, and PARSE are used to convert one data type into another in SQL Server, there are some subtle differences between them. The  CAST method accepts just two parameters, expression, and target type, but CONVERT() also takes a third parameter representing the format of conversion, which is supported for some conversions, like between character strings and date-time values. For example, CONVERT(DATE, '2/7/2015', 101) converts the character string '2/7/2015' to DATE using DATE format 101, representing United States standard.

Top 5 Spring MVC Annotations for Developing RESTful Web Services

Hello guys, Spring framework is one of the most popular Java framework and Spring MVC is probably the most common way to develop web applications in Java, but things just doesn't end there. In the past a couple of years, Spring has become the best way to develop RESTful Web services in Java. Despite numerous RESTful Web Service frameworks in Java world e.g. Restlet, Jersey, RESTEasy, and Apache CFX, Spring MVC has maintained its position as the leading framework for creating RESTful APIs in Java, and there are multiple reason why Spring is the best framework for Java developers for creating RESTful solutions and we will look one of them in this article.