Top 5 Spring Certification Books and Courses for Java Developers in 2024 - Best of Lot

If you are preparing for Spring Professional certification (VMware EDU-1202) and looking for the best books, online courses, and practice tests for your preparation then you have come to the right place. As an author of a Java blog and a medium publication, I often receive questions about how to self-prepare for a technical certification like Spring Professional v5.0 certification from Pivotal, and which are the best books and courses to prepare for Spring Core certification? After answering a couple of my readers over Facebook chats and linking in, I decided to jot down my recommendations. Books, Online Courses, Study Guides, and Practice tests are some of the important resources to prepare for Spring certifications.

Top 10 Cloud Certification (AWS, Azure, and GCP) You can Aim in 2024 - Best of Lot

Hello guys, if you are aiming for cloud certifications in 2024 but are not sure which cloud certification should you go for then you have come to the right place. Earlier, I have shared a list of the best IT certifications for Java developers, and today, I am going to talk about the best cloud certification to aim for in 2024. You can go through this list of cloud certifications and choose the best one depending upon your skills and experience. I have shared the best cloud certifications for beginners, developers, system admins, and solution architects from Amazon AWS, Microsoft Azure, and Google Cloud Platform. 

How to Prepare for VMware EDU 1202 - Spring Professional v.5.0 Certification Exam in 2024 [UPDATED]

Hello guys, If you have been doing Java development then you may know the benefits of the Spring Framework that make it one of the best Java frameworks in the community. As an open-source framework, Spring offered the opportunity to build applications on the Java Enterprise Edition platform. First introduced in October 2002, Spring Framework obtained a recent stable release in the form of Spring v5.0 which brought things like Reactive programming and WebFlux. There is a huge demand for Java developers with Spring experience, in fact, Spring is often considered as the most important skill while hiring Java developers and many companies prefer to hire those candidates who have Spring Professional certification in their resume.

Top 10 Books Java Developers Can Read in 2024

Hello guys, If you are a Java developer and wondering what to read in 2024, then you have come to the right place. In this article, I will share 10 books on Java, Spring, and related technology a Java developer can read. I have included books for both experienced Java developer who is more inclined to learn about architecture stuff,  developing for Cloud, Microservice, Java 9 to Java 16 features, and Spring 5 features and thinking of learning Kotlin to improve their productivity. Still, I have not forgotten junior and less experienced Java developers or some thinking of starting their journey into the Java world in 2024.

How to convert array to JSON in Java? Example Tutorial

Before converting an array to Json. It is good to have a good understanding of an array and what JSon is.  

What then is an Array? An array is a data structure in java that holds values of the same type with its length specified right from creation time. Or you can say an array is a collection of similar type of elements which has contiguous memory location.

Oftentimes you may have to work on a task whereby you will have to store a large number of values during the execution of a program. for instance, you need to read 50 numbers, calculate their average, and find out how many numbers are above the average, and how many numbers are below average.

How to check if an array includes a value in JavaScript? Example Tutorial

Hello Javascript developers, if you are wondering how to check if an array contains a particular value or not in Javascript then you have come to the right place. In the last article I showed you how to remove empty elements from the JavaScript array and today I will show you 3 ways to check if an array contains a particular value in Javascript. I have been sharing a lot of Javascript resources like the best JavaScript courses, books, websites, and Javascript interview questions, along with many JavaScript and React tutorials, and today, we are going to see an example of the includes() method of the array in JavaScript to find out if an array has a particular value or not.  

3 Books and Courses to Learn RESTful Web Services using Spring and Java in 2024 - Best of Lot

Hello guys, if you know the Spring framework, then there is a good chance that you have heard about the classic Spring in Action book by Craig Walls. It's one of the best books to learn Spring, and many Java developers, including me, have learned Spring from that. But, even though the Spring in Action 5th Edition is one of the best books to learn Spring framework, it's just not enough to learn the intricacies of developing a modern, full-featured RESTful Web Service using Spring Framework. It does have a chapter on developing RESTful Web Services. It nicely explains concepts like @RestController, @ResponseBody, @ResponseStatus, HTTP message converters, content negotiation, but that barely touches the surface of developing a production-quality RESTFul Web Service.

Top 10 Java 9 and Module Tutorials and Courses to Learn in 2024 - Best of Lot

It's been more than a couple of years or so since JDK 9 was launched, and the new year is probably the best time to learn Java 9 and get yourself familiar with new features and enhancements on existing APIs. The highlight of the JDK 9 release was Project Jigsaw or Module system. The Java 9 Platform Module System allows Java to move forward by modularizing the JDK as well as adding modules as first-class citizens to Java, but that's not the only thing to look forward to, there are many small changes that are very useful in day-to-day coding.

Top 5 Free Courses to learn Salesforce in 2024 - Best of Lot

Hello there, If you want to learn the Salesforce platform and looking for some free online Salesforce courses, then you have come to the right place. Earlier, I shared the best online practices for  Salesforce DeveloperAdministrator, and App Builder certification. Today, I will share free Salesforce courses beginners can use to learn this handy platform and add an in-demand skill to their resume. The Salesforce platform is a unique platform for custom application design, analytics features, and new features.

Top 5 Free Courses to Learn Ruby on Rails for Beginners in 2024 - Best of Lot [UPDATED]

Hello guys, welcome to this post, here you will find some of the best free courses to learn Ruby programming language and Ruby on Rails framework online from Udemy. If you don't know what Ruby is and what is Rails framework is, then let me tell you that it's one of the simplest programming languages with little to no syntax. If you are new to programming or never coded before, then also developing a Ruby application will be much more comfortable than choosing any other programming language like Python or Java

Top 5 Free Apache Spark Course for Beginners to Learn Online in 2024 - Best of Lot

Hello guys, if you are thinking of learning Apache Spark to start your Big Data journey and looking for some excellent free resources, e.g., books, tutorials, and courses, then you have come to the right place. This article will share some of the best free online Apache Spark courses for Java, Scala, and Python developers. If you don't know what is Apache Spark? And Why it's so crucial in the Big Data world, then let me give you a brief overview first. Apache Spark is another cluster computing framework like Hadoop, which analyzes a vast data set. Still, it's much faster than Hadoop, which makes it ideal for today's high computing needs, like processing a massive amount of data.

10 Essential JVM Options for Production Java Applications

Hello guys, this is a brief guide of appropriate JVM options, which you will often see in production Java systems. As a Java developer, you should know what these JVM options mean, their importance, and how they affect your application. You will find that most of the JVM options are related to heap memory, garbage collection and to log some details, like heap dump, necessary for troubleshooting heap-related issues like a memory leak or excessive memory consumption. It's Ok if you don't know these Java virtual machine options yet, but you should be familiar with them, and that's the objective of this article. Btw, how do you find the JVM options your application is using? Well, you can see the startup scripts through which your application is started.

Top 6 Online Course to learn from Java 9 to Java 21 in 2024 - Best of Lot

Hello guys, even though Java 15 is available now, many developers are still on Java 8 and not really caught up with changes in Java 9, 10, 11, 12, 13, or Java 14. If you are also in the same boat and want to start with Java 9 features, you have come to the right place. This article will share some of the best online courses to learn changes in Java 9, 10, 11, and later add more classes for Java 12, 13, 14, and 15. These JDK releases are packed with powerful features like modules, API enhancements like factory methods for an immutable list, set, and map, some changes on stream API and optional class, new features on process API, etc. 

OCPJP 11, OCP 17, or OCAJP 8? Which Java Certification should You Take in 2024?

Java certification is a great way to learn and master the Java programming language, do well on the interview and get recognition in the job, but the most common reason for doing Java certification is to find a job. After Oracle's acquisition and dividing the old SCJP exam into two exams OCAJP and OCPJP, it had become really confusing for many developers to decide which Java certification exam they should take, but thankfully that has changed now and now you can become an Oracle certified Java professional by passing just one exam, OCPJP 11 or Java SE 11 Developer 1Z0-819 certification, or Java SE 17 Developer 1Z0-829 certification in 2024. 

Top 5 Free Courses to Learn React Native Courses for Beginners in 2024 - Best of Lot

Hello guys, if you are learning React Native to make cross-platform apps and looking for some free courses to learn React Native then you have come to the right place. In the past, I have shared the free courses to learn ReactJS, and the best React Native courses, and today I am going to share the best free online training courses to learn React Native. The list includes both React Native crash courses as well as comprehensive courses to learn React Native in depth. There is a huge demand for cross-platform app frameworks like React Native and Flutter which allows you to create native-looking iOS and Android apps with the same code base.

How to Schedule Spring Professional Certification Exam (VMware EDU-1202) Online? [Guide]

Hello folks, even since Pivotal made the mandatory training optional for Spring certification, I have been writing a lot about Spring 5.0 Core Professional exam here. In the past, I have written about general preparation tips, books, coursesmock tests. So, after months of hard work and preparation, you are finally ready for the day. In order to schedule for the Spring certification exam, you first need to buy an exam voucher from Vmware's website. If you have taken their training course like the Core Spring training course, then you also receive a free voucher for 1 attempt.

Top 13 Free Java 8 Certification Sample Questions - OCAJP8 and OCPJP8 - 1Z0-808 and 1Z0-809 Exam Dumps

Hello guys, Java SE 11 certifications are already out but not many people are not going for it because of the difficulty level. If you want to become a certified Java developer then Java SE 8 is still the best possible option. If you are preparing for Oracle Java SE 8 Certifications, like OCAJP8 and OCJP8, also known as exams 1Z0-808 and 1Z0-809, and looking for some free practice tests, then you have come to the right place. Earlier, I have shared the best Java certification courses, and in this article, I am going to share some of the best OCAJP 8 and OCPJP 8 mock tests available for free of cost online, so that you can check your speed and accuracy before the real exam. 

10 Essential Spring MVC and REST Annotations with Examples for Java Programmers

Hello guys, welcome to my third article on exploring essential annotations from the Spring framework, the most popular framework for Java development. In the first article, I have shared some of the most useful Spring Framework annotations, which were based upon Core Spring functionalities like dependency injection, inversion of control, and configuration, and in the second article, you have learned about important Spring Cloud annotations like @EnableConfigServer, @EnableEurekaSever, and @EnableDiscoveryClient. Now that you know those essential Spring annotations it's time to move towards Spring MVC and REST, one of the most used parts of Spring Framework.

How to Implement Double Checked Locking Singleton Pattern in Java? Example Tutorial

Double-checked locking pattern is one of the interesting topics in Java Interviews. Earlier, it was asked to see if a Java developer can write code using a synchronized block or not, and now it asks to gauge the candidate's understanding of concurrency, volatile, and synchronization in Java. One of the simplest ways to write thread-safe Singleton was to make the getInstance() method synchronized but prior to JDK 1.6, a simple uncontented synchronization block was expensive, and that lead many developers to write the getInstance() method of the Singleton class using double-checked locking idiom

7 Difference between extends Thread vs implements Runnable in Java [Answer]

Hello guys, the difference between Thread vs Runnable in Java is a common Java multithreading interview question that is often asked by junior Java developers with 2 to 4 years of experience. If you are doing Java programming then you may know that Java provides multithreading to parallelize the execution of tasks (code) and you need multiple threads to run multiple things in parallel like downloading a file in the background and showing the progress bar at the front-end. There are two ways to create a Thread in Java, first by extending java.lang.Thread class and second by implementing the java.lang.Runnable interface. 

Difference between View and Materialized View in Database or SQL? [Answer]

The difference between View and Materialized view is one of the popular SQL interview questions, much like truncate vs delete, correlated vs noncorrelated subquery, or primary key vs unique key. This is one of the classic questions which keeps appearing in SQL interviews now and then and you simply can’t afford to learn about them. Doesn’t matter if you are a programmer, developer, or DBA, these SQL questions are common to all. Views are a concept which not every programmer is familiar with, it is simply not in the category of CRUD operation or database transactions or SELECT query, its little advanced concept for the average programmer.

How to find symbolic link or soft link in Linux? ls + find command Example Tutorial

There are two ways you can find a symbolic link or soft link in UNIX based operating systems like Linux, Solaris, BSD, or IBM AIX. The first way is by using the ls command in UNIX which displays files, directories, and links in any directory and the other way is by using UNIX find command which has the ability to search any kind of file e.g. file, directory, or link. In this UNIX command tutorial, we will see examples of both of these UNIX commands for finding a soft link in any directory. If you are new to UNIX operating system and not familiar with the concept of the soft link and hard link, I would recommend getting a good hand on it, as it is one of the most powerful features of UNIX based system.

10 Examples of forEach() method in Java 8

From Java 8 onward, you can iterate over a List or any Collection without using any loop in Java. The new Stream class provides a forEach() method, which can be used to loop over all or selected elements of the list and map. The forEach() method provides several advantages over the traditional for loop e.g. you can execute it in parallel by just using a parallel Stream instead of a regular stream. Since you are operating on stream, it also allows you to filter and map elements. Once you are done with filtering and mapping, you can use forEach() to operate over them. You can even use the method reference and lambda expression inside the forEach() method, resulting in a more clear and concise code.

3 Ways to return different content types from Spring MVC Controller? @RequestMapping and ResponseEntity Example Tutorial

Hello guys, if you want to provide different types from a Controller in Spring MVC and wondering how to do that then you have come to the right place. In the past, I have shared the free Spring MVC courses, books, and interview questions and in this article, I am going to show you three ways to send different content types from Spring Controller. There are various content types for a controller and we are going to discuss them in this tutorial. So we are going to discuss how to interpret the data present in the request and response. JSON is one of the media formats that may be consumed/produced using this request-response architecture.

How to sort an Array in descending order in Java? Example Tutorial

Sorting an array is one of the common tasks in Programming and you have many algorithms to sort an array, like QuickSort, MergeSort which provides O(NLogN) time performance, and Bucket Sort, Counting Sort, and Radix Sort algorithms which can even sort some array in O(N) time. But, you hardly need to code these algorithms by hand when it comes to writing real code. The Programming language you will use already has tried and tested implementation for those algorithms and that's what you will learn in this article. In Java Programming language, it's easy to sort an array, you just need to call the Arrays.sort() method with a Comparator which can sort the array in the order you want but it highly depends upon which type of object is stored in the array.

How to pause a Thread in Java? Thread.sleep and TimeUnit.sleep Example

There are multiple ways to pause or stop the execution of the currently running thread in Java, but putting the thread into a sleep state using the Thread.sleep() method is the right way to introduce a controlled pause. Some Java programmers would say, why not use the wait and notify? Using those methods just for pausing a thread is not a good coding practice in Java. Those are the tools for a conditional wait and they don't depend on time. A thread blocked using wait() will remain to wait until the condition on which it is waiting is changed. Yes, you can put timeout there but the purpose of the wait() method is different, they are designed for inter-thread communication in Java

10 Examples of ALTER Table Command in SQL

In this SQL tutorial, you will learn how to use ALTER command in the table on the database. ALTER command is mainly used to add, modify and drop columns, indexes, and constraints on the table in relational databases e.g. MySQL, Oracle, Sybase, and SQL Server.  Though ALTER is not part of classical CRUD operation but it’s one of the important DDL commands. One of the most frequent uses of ALTER command in SQL is adding and removing indexes to improve the performance of SQL SELECT queries.

5 Difference between Interface and Abstract class in Java? [Answer]

What is abstract class and interface in Java?
The difference between abstract class and interface in Java is one of the tricky Java interview questions and mostly appears in core Java interviews. It has become now even trickier after Java 8 introduced default methods and allowed interfaces to have both default and static methods. Even though both interface and abstract class are a way to achieve abstraction in Java, there are significant differences between them, which you will learn in this article. Some time interviewer also not just focuses on key differences between abstract class and interface in Java but he is also interested in some practical experience e.g. when to use interface in Java and when to use an abstract class in Java.

Top 100 Angular Interview Questions for 1 to 2 Years Experienced Developers

Angular is one of the popular JavaScript frameworks, I think most popular after jQuery, with the core goal of simplification. It allows building dynamic, single-page web apps (SPAs) using JavaScript and supports the Model View Controller (MVC) programming structure. It has been used widely and even big companies like Google, Virgin America, and HBO are using Angular to build their site. The demand for web developers is at an all-time high and there is a huge demand for developers who understand modern JavaScript frameworks like Angular, jQuery, Facebook's React JS, etc. Angular is an Open-source, front-end JavaScript framework which is developed by Google, it mainly competes with Facebook's ReactJS framework

OCMJEA 6 FAQs - Oracle Certified Master - Java EE 6 Enterprise Architect (1Z0-807, 1Z0-865 and 1Z0-866) - Frequently asked Questions

The OCMJEA (Oracle Certified Master Java EE Enterprise Architect) is one of the toughest Java certifications to crack, even for experienced Java developers. It requires architectural decision skills for the given business problem. Step 1 multiple-choice tests your skills by scenario-based business problems to choose the best design solution. The exam not only covers the Java EE platform but also tests your security, hardware architecture, and design pattern skills.

Difference between UNION vs UNION ALL in SQL? Example

Hello guys, what is the difference between UNION vs UNION ALL is one of the most popular SQL interview questions and often asked programmers during a telephonic round of interviews. Though both UNION and UNION ALL is used to combine results of two SELECT queries, the main difference between them is that UNION doesn't include duplicate record but UNION ALL does. Another difference between them is that UNION ALL is faster than UNION but may look slow because it returns more data which takes more time to travel via the network. The difference between UNION and UNION ALL can be a tricky SQL question, especially for developers, who have not used this useful keyword ever. 

Java 8 Stream + FlatMap Example for Beginners | How to flat a list of list in Java?

In order to understand the flatMap() method, you first need to understand the map() function of Java 8. The map() function is declared in  the java.util.stream.Stream class and uses to transform one Stream into another, for example, it can convert a stream of integer numbers into another stream of ints where each element is the square of the corresponding element in the source stream. In the map() operation, a function is applied to each element of the source Stream and return values are inserted into a new Stream which is returned to the caller. The key point to note here is that the function used by the map() operation returns a single value.

How to get and set Value of a text field using jQuery? Example Tutorial

Hello guys, In the last jQuery tutorial, you learn how to dynamically add a text file into a form, and in this tutorial, I will show you how to get and set the value of the text field using jQuery. This is a common task and there is a good chance that you have already done something similar in your project. Our requirement is simple, the text field initially contains the value "username" and as soon as the user clicks on it to enter a username, it should become clear. After the user has entered the username of the user id, he can click on the submit button, and then your program should print the username and text field again becomes clear.

QuickSort Algorithm Example in Java using Recursion - Tutorial

The Quicksort algorithm is one of the very popular sorting algorithms in programming, often used to sort a large array of numbers. Though there is numerous algorithm available to sort a list of objects, including integer, string, and floating-point number, quicksort is best for general purpose. It's a divide and conquers algorithm, where we divide the given array with respect to a particular element, known as 'pivot' such that the lower partition of the array is less than the pivot and upper partition elements of the array are higher than the pivot.

How to remove a number from an Integer Array in Java? [Example Tutorial]

Hello guys, In the last article, you have learned how to reverse an array in place in Java, and today I have come back with another array-based coding interview question. It's also one of the frequently asked coding questions, not as popular as the previous one but still has been asked a lot of times on various Programming Job interviews, particularly to beginners. In this problem, you are asked to write a program to remove a given number from the given array. It may seem easy, but the trick is that because an array is a fixed data structure and you cannot change the length of the array once created. 

3 ways to sort a List in Java 8 and 11 - Example Tutorial

There are multiple ways to sort a list in Java 8, for example, you can get a stream from the List and then use the sorted() method of Stream class to sort a list like ArrayList, LinkedList, or Vector and then convert back it to List. Alternatively, you can use the Collections.sort() method to sort the list. There is also a sort() method added to the List class itself. The Collections.sort() method is an older one and it's available from JDK 1.0 itself but List.sort() is a new method added in Java 8. This method accepts a Comparator if you want to sort a List in a custom order, otherwise, you can pass null if you want to sort a List on the natural order of their elements. 

5 Free SQL Books For Beginners and Experienced - Download PDF or Read Online

There is no doubt that SQL is one of the most essential skills for Programmers, IT professionals, Software Engineers, Quality Analysts, Project Manager, Data scientists, Database admins, and Business Analysts. I had even mentioned this as one of the top skills in my post about 10 things every programmer should know, if you haven't read that yet, you can read it here, it's completely worth your time. Since many Enterprise applications use the relational database at their backend, like Oracle, Microsoft SQL Server, MySQL, it's crucial to learn SQL to work with those applications and use the data stored on those databases.

How Binary Search Algorithm Works? Java Example without Recursion

The binary search algorithm is one of the fundamental Computer Science Algorithms and is used to search an element in a sorted input set. It's much faster than the linear search which scans each and every element and improves performance from O(n) to O(logN) for searching an element in the array. In order to perform the binary search, you need a sorted array, so you can either ask the user to enter the array in sorted order or you should sort the array before performing the binary search. It's also one of the popular algorithms for Programming Job interviews. The interviewer often asks candidates to implement binary search algorithms by hand in their favorite programming languages like Java, C++, Python. or JavaScript.

How to solve java.lang.NoClassDefFoundError: org/springframework/beans/factory/SmartInitializingSingleton in Spring Boot [Solved]

Problem:
I was trying to run a HelloWorld program using Spring Boot when I got this error:

Exception in thread "main" java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer due to internal class not found. This can happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:52)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:92)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:174)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:136)

10 Examples to DateTimeFormatter in Java 8 to Parse, Format LocalDate and LocalTime

Parsing and formatting dates are other essential topics while working with date and time in Java. Even though the old Date API had the SimpleDateFormat and DateFormat class to support the formatting of date and parsing texts, they were not simple, or should I say there were just simple in writing the wrong code. You might know that SimpleDateFormat was not thread-safe and quite heavy to be used as a local variable. Thankfully, this has been sorted now with a new LocalDateTime class and DateTimeFormatter class, which has several inbuilt formats.

How to declare and Initialize two dimensional Array in Java with Example

An array of more than one dimension is known as a multi-dimensional array. Two of the most common examples of multi-dimensional arrays are two and three-dimensional arrays, known as 2D and 3D arrays, anything above is rare. I have never seen 4-dimensional arrays, even 3D arrays are not that common. Now the question comes when to use a multi-dimensional array? Any real-life example? Well, 2D arrays are very common on platform games like Super Mario Bros to represent screen or terrain; 2D arrays can also be used to represent structures like a spreadsheet, or to draw board games like Chess, which requires an 8x8 board, Checkers and  Tic-Tac-Toe, which requires 3 rows and 3 columns.

Difference between first level and second level cache in Hibernate

The main difference between the first level and second level cache in Hibernate is that the first level is maintained at the Session level and accessible only to the Session, while the second level cache is maintained at the SessionFactory level and available to all Sessions. This means, you can use the first-level cache to store local data, i.e. the data which is needed by the Session, and you can use the second-level cache to store global data, i.e. something which can be shared across sessions. This is also one of the frequently asked Hibernate Interview questions and accessible in both telephonic rounds as well as on the face-to-face interviews, in both fresher and experienced level interviews.

Difference between IN, OUT, and INOUT parameters in JDBC Stored Procedure? Answer

Hello guys, Java Database Connectivity, the JDBC API supports three types of parameters, I mean, IN, OUT, and INOUT. They are used to bind values into SQL statements. An IN parameter is the one whose value is unknown when the SQL statement is created and you bind values using various setXXX() method depending upon the type of column those IN parameter refers in SQL query. For example in SQL query, SELECT * from EMPLOYEE where EMP_ID=? if the EMP_ID is a VARCHAR column then you must call the setString() method to pass the value to the IN parameter. 

How to use lifecycle methods in functional components in React.js? useEffect() hook Example Tutorial

Hello guys, if you have been following my blogs then you know that I have launched a new series - React for Java developers and this is the 4th article on the series. Earlier, we have seen state management in React, Redux, and useState hooks example, and in this article, you will learn about how to use lifecycle methods in functional React components. Lifecycle methods are powerful features provided by React.js in the class-based components. Each of the lifecycle methods executes at a particular time during the lifecycle of a component. 

How to compare two Arrays in Java to check if they are equal - [String & Integer Array Example]

Hello guys, one of the common Programming, the day-to-date task is to compare two arrays in Java and see if they are equal to each other or not. Of course, you can't compare a String array to an int array, which means two arrays are said to be equal if they are of the same type, has the same length, contains the same elements, and in the same order. Now, you can write your own method for checking array equality or take advantage of Java's rich Collection API. Similar to what you have seen while printing array values in Java, java.util.Arrays class provides convenient methods for comparing array values.

How to Convert or Print Array to String in Java? Example Tutorial

Array and String are very closely related, not just because String is a character array in most of the programming language but also with popularity - they are two of the most important data structure for programmers. Many times we need to convert an array to String or create an array from String, but unfortunately, there is no direct way of doing this in Java. Though you can convert an array to String by simply calling their toString() method, you will not get any meaningful value.  If you convert an Integer array to a String, you will get something like I@4fee225 due to the default implementation of the toString() method from the java.lang.Object class. Here, I show the type of the array and content after @ is hash code value in hexadecimal.

How to Format Date to String in Java 8 [Example Tutorial]

One of the common programming tasks in Java is to change the date format of a given Date or String. For example, you have something like "2017-01-18 20:10:00" and you want to convert it that date into "2017-01-18", or you want to convert from dd-MM-YY to MM-dd-YY or to any other format of your choice and need, but a valid date format as per Java specification. How will you do that? Well, it's not that difficult. It's just a two-step process. In the first step, you need to parse String to create an equivalent date using the current format, and then once you got the date, you need to again convert it back to String using the new format. The same process is repeated in both Java 8 and before, only corresponding API and class changes.

Can you Overload or Override main method in Java? Example

One of the common doubts among Java beginners while learning the overloading and overriding concept is, whether it's possible to overload the main in Java? Can you override the main method in Java? How will JVM find if you change the signature of the main method as part of the method overloading? etc. These are good questions and show the curiosity and application of knowledge of students, so if you are the tutor you must answer these questions. If you don't know the answer to this question, don't worry, just read this article till the end and you will find the answer yourself.  I have tried to explain in simple words but if you still can't get it, feel free to comment and I will try to help you personally. 

10 Advanced Programming and Development Books for Experienced Developers - Best of Lot

Hello guys, if you are looking for some advanced programming and development books to take your coding and software development skill to next level then you have come to the right place. Earlier, I have shared advanced courses in Java, Python, C++, and JavaScript and in this article, I am going to share some good books for the experienced programmer which can help them to become an expert. Learning never stops but once you become a professional programmer and spent a couple of years doing professional programming, you need to make some effort to reach the next level i.e. to become an expert programmer. Continuously doing the same stuff and not analyzing will not make you better. This is where these books can help you.

4 Examples of Stream.collect() method in Java 8

Hello guys, you may know that Java 8 brought Stream API which supports a lot of functional programming operations like filtermapflatMap, reduce, and collect. In this article, you will learn about the collect() method. The collect() method of Stream class can be used to accumulate elements of any Stream into a Collection. In Java 8, you will often write code that converts a Collection like a List or Set to Stream and then applies some logic using functional programming methods like the filter, map, flatMap and then converts the result back to the Collection like a ListSetMap, or ConcurrentMap in Java.

Difference between List and ArrayList Reference Variables in Java? Example Tutorial

Someone who is just starting with Java programming language often has doubts about how we are storing an ArrayList object in List variable, what is the difference between List and ArrayList? Or why not just save the ArrayList object in the ArrayList variable just like we do for String, int, and other data types. Well, the main difference between List and ArrayList is that List is an interface while ArrayList is a class. Most importantly, it implements the List interface, which also means that ArrayList is a subtype of the List interface. In Java or any object-oriented language, the supertype of a variable can store an object of subtype.

How to Increasing Heap Size of Java application in JVM? Example Tutorial

Hello guys, if you are wondering how to change the heap size of the heap space of your Java application then you have come to the right place. In this article, I am going to tell you how to increase Java heap space so that your JVM will not crash using OutOfmemoryError. We have already seen how to increase heap memory in Maven and ANT and now we will learn how to increase heap size in Java, Eclipse, Tomcat, and WebSphere Server in a series of articles. Since all these are Java applications, once you know how to change heap space in Java, you can do that in any Java application, provided you know the right place, which is what we will see in this article.

The Ultimate Guide of Remote Debugging in Java using Eclipse IDE? Example Tutorial

The remote debugging of the Java program is an ultimate tool in the arsenal of a Java developer, which is often becoming the last and only tool to investigate a bug on a Java application running on the remote host like on a Linux server or Windows server. Almost all major Java IDE provides remote debugging like NetBeans, Eclipse, and IntelliJ IDEA, but I mostly use Eclipse for Java coding and so it's my preferred tool to remote debug a Java program. In order to set up remote debugging in Eclipse, you need to do a couple of tasks like you need to start your JVM with debugging parameters or arguments and then you need to create a "remote debug configuration" in Eclipse IDE itself.

How to Convert java.util.Date to LocalDate in Java 8 - Example Tutorial

Hello guys, once you move to Java 8, you will often find yourself working between old and new Date and Time API, as not all the libraries and systems you interact with will be using Java 8. One of the common tasks which arise from this situation is converting old Date to new LocalDate and that's what you will learn in this tutorial. There seems to be a couple of ways to convert a java.util.Date to java.time.LocalDate in Java 8, but which one is the best way? We'll figure it out in this article, but first, let's explore these different ways to convert a java.util.Date object to LocalDate in Java 8 code.

How to parse String to LocalDate in Java 8 - DateTimeFormatter Example

From Java 8 onward, you are no longer dependent on the buggy and bulky SimpleDateFormat class to parse and format date Strings into real Date objects in Java e.g. java.util.Date. You can use the DateTimeFormatter class from java.time package for all your formatting and parsing need. You are also no longer required to use another buggy class java.util.Date if you are doing fresh development, but if you have to support legacy code then you can also easily convert LocalDate and LocalTime to java.util.Date or java.sql.Date. In this tutorial, we will learn about both parsing String to date in Java and formatting Date into String.

Java 8 Stream filter() + findFirst Example Tutorial

Suppose, you have a list of prime numbers and you need to find the first prime number which is greater than a given number? How do you find it? Don't tell that you will loop through the list and check each element and return the first element which is greater than the given number. Well, that's right but that's not what you should do in Java 8. That's good for Java 7 or earlier version but Java 8 offers you many better alternatives and one of them is Stream. You can use the Stream class along with filter() and findFirst() methods to find out an element based upon a Predicate, a functional interface for defining a condition which returns a boolean.

How to add and remove Elements from an Dynamic Array in Java? Example Tutorial

Java beginners often ask how to add new elements to an array in Java? or how to remove elements from an array in Java? is that possible in Java? Well, no, it's not possible in Java because arrays length cannot be changed once created. This means neither you can add new elements nor you can remove an old one from an array in Java. All you can do is reassign values to a different bucket. For example, if you have a string array of length 3 like {"java", "is", "great"} then you can just replace the individual index to make it like {"Python", "is", "great"} by replacing "java" with "Python" at first index, but you cannot add or remove elements.

How to Remove Objects From ArrayList while Iterating in Java - Example Tutorial

One of the common problems many Java Programmers face is to remove elements while iterating over ArrayList in Java because the intuitive solution doesn't work like you just cannot go through an ArrayList using a for loop and remove an element depending upon some condition. Even though java.util.ArrayList provides the remove() methods, like remove (int index) and remove (Object element), you cannot use them to remove items while iterating over ArrayList in Java because they will throw ConcurrentModificationException if called during iteration. The right way to remove objects from ArrayList while iterating over it is by using the Iterator's remove() method.

How to implement PreOrder traversal of Binary Tree in Java - Example Tutorial

The easiest way to implement the preOrder traversal of a binary tree in Java is by using recursion. The recursive solution is hardly 3 to 4 lines of code and exactly mimic the steps, but before that, let's revise some basics about a binary tree and preorder traversal. Unlike array and linked list which have just one way to traverse, I mean linearly, the binary tree has several ways to traverse all nodes because of its hierarchical nature like level order, preorder, postorder, and in order. Tree traversal algorithms are mainly divided into two categories, the depth-first algorithms, and breadth-first algorithms. In depth-first, you go deeper into a tree before visiting the sibling node, for example, you go deep following the left node before you come back and traverse the right node.

How to reverse a singly linked list in Java without recursion? Iterative Solution Example

Hello guys, reverse a linked list is a common coding problem from Programming Job interviews and I am sure you have seen this in your career, if you are not, maybe you are a fresher and you will going to find about this very soon in your next technical interview. In the last article, I have shown you how to use recursion to reverse a linked list, and today, I'll show you how to reverse a singly linked list in Java without recursion. A singly linked list, also known as just linked list is a collection of nodes that can only be traversed in one direction like in the forward direction from head to tail. Each node in the linked list contains two things, data and a pointer to the next node in the list.

How to Convert String to LocalDateTime in Java 8 - Example Tutorial

Hello guys, today, I will talk about a common problem while working in a Java application, yes you guessed it right, I am talking about String to Date conversion in Java. I had discussed this before (see the Date to String) when Java 8 was not out, but with Java 8, I don't see any reason to use old date and time API, and hence I am writing this post to teach you how to convert String to Date in Java 8 or beyond. Suppose you have a date-time String "2016-03-04: 11:01:20" and you want to convert this into a LocalDateTime object of Java 8 new date and time API, how do you do that? Well, if you have worked previously with String and Date then you know that you can parse String to Date in Java.

How to use Stream.filter method in Java 8? Example Tutorial

In the last couple of Java 8 tutorials, you have learned how to use map(), flatMap(), and other stream methods to get an understanding of how Java 8 Stream and Lambda expressions make it easy to perform the bulk data operation on Collection classes like List or Set. In this Java 8 tutorial, I am going to share how to use the filter() method in Java 8, another key method of the Stream class.  This is the one method you will always be used because it forms the key part of the Stream pipeline. If you have seen some Java 8 code, you would have already seen this method a couple of times.

10 Examples of Stream API in Java 8 - count + filter + map + distinct + collect() Examples

The Java 8 release of Java Programming language was a game-changer version. It not only provided some useful methods but totally changed the way you write programs in Java. The most significant change it brings in the mindset of Java developers was to think functional and supported that by providing critical features like lambda expression and Stream API, which takes advantage of parallel processing and functional operations like filter, map, flatMap, etc. Since then, a lot of Java developers are trying their hands to learn those significant changes like lambda expression, method reference, new Date and Time classes, and, more importantly, Stream API for bulk data operations.

How to debug Java 8 Stream Pipeline - peek() method Example Tutorial

Hello guys, I have been writing about some important methods from Java SE 8  like map(), flatMap(), collect(), etc for quite some time, and today I'll share my experience with another useful method peek() from java.utill.stream.Stream class. The peek() method of the Stream class can be very useful to debug and understand streams in Java 8. You can use the peek() method to see the elements as they flow from one step to another like when you use the filter() method for filtering, you can actually see how filtering is working like lazy evaluation as well as which elements are filtered.

How to Calculate Next Date and Year in Java? LocalDate and MonthDay Example Tutorial

Hello guys, if you are wondering how to calculate the next premium date, next birthday, or exact date for the next Christmas holiday in Java then you have come to the right place. Earlier, I have shared 20+ examples of Date and Time in Java, and in this article, I will show you how you can use the LocalDate and MonthDay class from the new Java 8 Date and Time package to calculate the next or previous date in Java. This new API is very well structured and you have classes to represent different Date concepts, for example, you can use LocalDate to represent a Date without time components like the next premium date or employee joining date or birth date. 

How to Reverse an Array in place in Java? Example Solution

It's relatively easy to reverse an array if you have the luxury to use another array, but how would you reverse an array if a temporary buffer is not allowed? This is one of the testing array interview questions, which often proved tricky for Java and other beginner Programmers. But, don't worry, I'll tell you how you can solve this problem without losing your cool. Well, you can also reverse an array in place without using an additional buffer. If you know how to access array elements and how to loop over an array in Java using traditional for loop, you can easily solve this problem without using additional space or in-place as described in many Algorithms books and courses, and on Coding interviews.

3 ways to ignore null fields while converting Java object to JSON using Jackson? Example

Ignoring null fields or attribute is a one of the common requirement while marshaling Java object to JSON string because Jackson just prints null when a reference filed is null, which you may not want. For example, if you have a Java object which has a String field whose value is null when you convert this object to Json, you will see null in front of that. In order to better control JSON output, you can ignore null fields, and Jackson provides a couple of options to do that. You can ignore null fields at the class level by using @JsonInclude(Include.NON_NULL) to only include non-null fields, thus excluding any attribute whose value is null.

5 Differences between an array and linked list in Java

The difference between an array and a linked list is one of the frequently asked data structure and algorithm interview questions and you might have seen it before on your telephonic or face-to-face interview. It is also a very popular question during practical exams in Computer Science degree courses like B.E. and B.Tech. It's very simple and easy to answer but you just can't afford to miss this question in an interview. Both array and linked list are two of the most popular and fundamental data structures in Computer Science and Programming, and Java supports both of them.

What is difference between final vs finally and finalize in Java?

Hello guys, final, finally, and finalize are three confusing keywords, modifiers, and methods in Java. They sound similar, but they are for different purposes. For example, the final keyword is a modifier in Java. When you use the final keyword with a class, it becomes a final class, and no one can extend this like String is final in Java. When you use the final modifier with a method, then it cannot be overridden in a subclass, and when you use the final keyword with a variable, it becomes a constant, i.e. its value cannot be changed once assigned.

How to convert ArrayList to HashMap and LinkedHashMap in Java 8 - Example Tutorial

One of the common tasks in Java is to convert a List of objects, like a List<T> into a Map, I mean Map<K, V>, where K is some property of the object and V is the actual object. For example, suppose you have a List<Order>, and you want to convert it into a Map, e.g. Map<OrderId, Order>, how do you that? Well, the simplest way to achieve this is iterating over List and add each element to the Map by extracting keys and using the actual element as an object. This is exactly what many of us do in the pre-Java 8 world, but JDK 8 has made it even simpler.

How to code Binary Search Algorithm using Recursion in Java? Example

Hello guys, In the last article, we have seen the iterative implementation of binary search in Java, and in this article, you will learn how to implement binary search using recursion. Recursion is an important topic for coding interviews but many programmers struggle to code recursive solutions. I will try to give you some tips to come up with recursive algorithms in this tutorial. In order to implement a recursive solution, you need to break the problem into sub-problems until you reach a base case where you know how to solve the problem like sorting an array with one element. Without a base case, your program will never terminate and it will eventually die by throwing the StackOverFlowError.

Post Order Binary Tree Traversal in Java Without Recursion - Example Tutorial

In the last article, I have shown you how to implement post-order traversal in a binary tree using recursion, and today I am going to teach you about post order traversal without recursion. To be honest, the iterative algorithm of post-order traversal is the toughest among the iterative pre-order and in-order traversal algorithm. The process of post-order traversal remains the same but the algorithm to achieve that effect is different. Since post-order traversal is a depth-first algorithm, you have to go deep before you go wide. I mean, the left subtree is visited first, followed by the right subtree, and finally, the value of a node is printed.

7 Examples to Sort One and Two Dimensional String and Integer Array in Java | Ascending, Descending and Reverse Order

Sorting array is a day-to-day programming task for any software developer.  If you have come from a Computer Science background then you have definitely learned fundamental sorting algorithms like the bubble sort, insertion sort, and quicksort but you don't really need to code those algorithms to sort an array in Java because Java has good support for sorting different types of array. You can use Arrays.sort() method to sort both primitive and object array in Java. But, before using this method, let's learn how the Arrays.sort() method works in Java. This will not only help you to get familiar with the API but also its inner workings.  This method sorts the given array into ascending order, which is the numeric order for primitives and defined by compareTo() or compare() method for objects.

How to prepare Oracle Certified Master Java EE Enterprise Architect (1z0-807, 1Z0-865, 1Z0-866) - OCMJEA6 Exam

The OCMJEA 6 certification is one of the most difficult, time-consuming, and tiresome Java certifications. Still, it was also the one that made me learn and grow professionally. This certification consists of 5 phases:

Phase 1: Compulsory Course

At this point, the candidate is required to take at least one official Oracle course from Java at any partner company. You can complete this course during certification - before, during, or after.

If you already have experience in Java and architecture, leave to take the course at the end. If not, use the classes to gain knowledge for the test by doing them before. There is a complete grid of Java courses for the candidate to acquire the necessary know-how for this certification.

Top 5 Free Apache Maven eBooks for Java Developers

If you are working in Java for a couple of years, you surely know about Maven, the most popular tool to build Java applications. Recently I had shared 10 things about Maven Java developers should know, (if you have read it yet, you can read it here) and I receive a lot of good feedback about how useful those plugins and Maven, in general, are for Java developers. This motivated me to write more stuff about Apache Maven, and then I thought about sharing some of the free Maven courses and ebooks Java developers can use to learn Maven. 

Top 4 Free Microsoft SQL Server Books - PDF Download or Online Read

Hello Guys, if you want to learn SQL Server and looking for free resources then you have come to the right place. Earlier, I have shared free SQL and database courses and today, I am going to share some of the excellent database and SQL server books that are freely available on the internet for reading online or download as PDF. If you have been reading this blog then you know that I love books, I love to read books, and I love to collect books, that's why I have a significant online and offline library. Many people question me, do I really find to read all the books which I share? Well, I don't read all books page by page, unless and until it's something like Effective Java or Clean Code

4 Best Books to Learn Web Service in Java - SOAP and RESTful

If you are a Java developer and want to learn how to develop Web Services in Java, both SOAP and RESTful, but confused about where to start, then you have come to the right place. In this article, I am going to share some of the best books to learn about both SOAP and RESTful web services in Java. If you are not familiar with Web Services, it's a way to expose the services provided by your application to other developers and applications. For example, if your system offers weather information, then the user can go and check whether manually by looking at the Web GUI built using HTML, CSS, and JavaScript. Still, by exposing the same information using Web services, you allow a programmer to display as they want.

What is the cost of Oracle Java Certifications - OCAJP, OCPJP, OCEWCD, OCPJD?

One of the frequently asked questions about Oracle Java certifications, formerly known as Sun Certified Java programmer like OCAJP, OCPJP, OCEWCD, OCMEJA, etc. is about the cost of certification. Many of my readers often ask what the cost of OCAJP  like OCAJP 8 or OCAJP 11 and  OCPJP like OCPJP 8 and OCPJP 11 is? Is there any discount available? What are the fees of Java 8 certifications? How much Java architect exam cost? Etc. I have answered many of them one to one via Facebook and Email in the past, but after so many such requests, I decided to write a blog post about it.

Insertion Sort Algorithm in Java with Example

Insertion sort is another simple sorting algorithm like Bubble Sort. You may not have realized but you must have used Insertion sort in a lot of places in your life. One of the best examples of Insertion sort in the real-world is, how you sort your hand in playing cards. You pick one card from the deck, you assume it's sorted, and then we insert subsequent cards in their proper position. For example, if your first card is Jack, and the next card is Queen then you put the queen after Jack. Now if the next card is King, we put it after the queen, and if we get 9, we put it before jack.

Difference between VARCHAR and NVARCHAR in SQL Server

Hello guys, if you are confused between VARCHAR and NVARCHAR data types of SQL Server and wondering what is the difference between VARCHAR and NVARCHAR, or you have been asked this question on technical Interviews and you couldn't answer then you have come to the right place. There is a subtle difference between these two character data types in SQL Server, while both supports variable length, the VARCHAR data type is used to store non-Unicode characters while NVARCHAR is used to store Unicode characters. It also takes more space than VARCHAR. 

How to Rotate an Array to Left or Right in Java? Solution Example

Hello guys, welcome to another post with another array-based coding problem. In the last article, we've learned about finding missing numbers in the array with duplicates, and today we'll solve the problem of rotating an array by left or right by a given number. For example, suppose an integer array {1, 2, 3} is given and it was asked to rate this array to the left by 3 then the result array will look like {2, 3, 1} because it was rotated twice on left. Similarly, if you are asked to rotate the same array twice by right then you'll get {1, 2, 3}, the same array is back. 

How to implement Comparator and Comparable in Java with Lambda Expression & method reference? Example

Hello guys, After Java 8 it has become a lot easier to work with Comparator and Comparable classes in Java. You can implement a Comparator using lambda expression because it is a SAM type interface. It has just one abstract method compare() which means you can pass a lambda expression where a Comparator is expected. Many Java programmers often ask me, what is the best way to learn lambda expression of Java 8?  And, my answer is, of course by using it on your day to the day programming task. Since implementing equals(), hashcode(), compareTo(), and compare() methods are some of the most common tasks of a Java developer, it makes sense to learn how to use the lambda expression to implement Comparable and Comparator in Java.

Difference between List <?> and List<Object> in Java Generics - Example

There is No doubt that Generics is one of the most confusing topics in Java, and you can easily forget concepts and rules, especially if you don't code Java every day. For example, both List<?> and List<Object> looks similar there is a subtle difference between them, the List<?> is basically a list of any type, you can assign a list of String like List<String> or list of Integer i.e. List<Integer> to it. You see the point; it uses the unbounded wildcard <?>, which means any type. It provides it the much needed Polymorphism requires while writing Generic methods. 

Java - Difference between getClass() and instanceof in equals() method?

You might have seen both getClass(), and instanceof operator in Java can be used in the equals() method to verify the type of the object you are checking for equality. Do you know what the difference is between using getClass() vs instanceof operator in Java? What would be the consequence of using one over the other in the equals() method? This is one of the tricky Java interview questions, which some of you might have encountered. There is a very subtle difference between getClass() and instanceof operator, which can cause potential issues with respect to the equals() method. 

How to Read or Parse CSV files with Header in Java using Jackson - Example Tutorial

Hello guys, today I am going to show you how to read a CSV file in Java with a simple example of Jackson API. For a long time, I only knew that Jackson can be used to parse JSON but later realized that you can also use it to parse or read CSV files in Java. The Jackson DataFormat CSV library allows you to read a CSV file in just a couple of lines and it's really powerful and feature-rich. For example, you can read a CSV file with a header or without a header. You can even read a tab-delimited text file like CSV. It's also highly configurable and allows you to define a columns separator to read a text file with any delimiter. You can even use it to directly convert the CSV data into Java objects, just like we do while reading JSON String in Java.

Can You Run Java Program Without a Main Method? [Interview Question Answer]

Hello guys, the first thing Java programmers learn is that they need a main method to run, but when they go to any Interview or college viva and ask can run a Java program without a main method, they are surprised like hell. Well, there are actually different types of execution models available in Java; for example, Applets, which run on the browser don't have the main method. Instead, they have life-cycle methods like init(), start() and stop(), which controls their execution. Since Applet is a Java program, you can answer this question is Yes. Similarly, we have Servlet, which runs in a Servlet container, comes as bundled in a web server like Tomcat, or Jetty.