Preparing for Java and Spring Boot Interview?

Join my Newsletter, its FREE

3 Difference between Web Server vs Application Server vs Servlet Containers - Apache vs JBoss vs Tomcat

In the Java EE, or J2EE or JEE world, there is a lot of confusion between terminology, which is quite evident that now we have three words (J2EE, Java EE, and JEE) to describe the same technology platform. You will see Java developers using the terms like Web Server, Application Server, and Servlet containers interchangeably but they are not exactly the same. The main difference between a Web server and an application server is that a web server is meant to serve static pages like HTML and CSS, while an Application Server is responsible for generating dynamic content by executing server-side code like JSP, Servlet, or EJB.

Top 10 Microservices Design Principles with Examples

Hello guys, today's world is about Microservices because Microservices goes hand-in-hand with Cloud Computing. They are designed better to run on Cloud Computing. Since all new Software development is most likely going to happen cloud-native, it's important for developers to learn about Microservices, particularly Java developers. To help with that, I have shared best Microservices courses and books in the past as well as 10 Microservices design patterns and in this article, I am going to share 10 common Microservices design principles. If you are wondering what is difference between patterns and principles? 

10 Examples of Comparator, Comparable, and Sorting in Java 8

Hello guys, the Comparator class is used to provide code or logic for comparing objects in Java, while sorting a list of objects or a collection of objects. It's close cousin of Comparable which provides natural order sorting e.g. ascending and descending orders for numbers like int, short, long or float, and lexicographic order for String i.e. the order on which words are arranged in dictionaries. The Comparators are used while sorting arrays, lists and collections. You pass logic to compare objects and sorting methods like Collections.sort() use that logic to compare elements until they are arranged in sorted order. 

How to Convert String to LocalDate, LocalTime, LocalDateTime and ZonedDateTime in Java? Example Tutorial

The JDK 8 added a new Date and Time API (JSR 310) which introduces new date and time classes like LocalDateLocalTime, LocalDateTime, and ZonedDateTime. Now, if you have a String e.g. "2016-12-14 03:30" then how do parse it to LocalDate, LocalTime, LocalDateTime and ZonedDateTime? Similarly, if you have an instance of those classes how you can format to the String you want e.g. in dd/MM/yyyy format, or USA or UK format? Well, Java 8 provides a utility class called DateTimeFormatter which can be used to parse/format dates in Java 8. It also provides several built-in formatter e.g. ISO date format and other to facilitate formatting of dates to String.

How to convert JSON to Map in Java 8 without using third party libraries like Jackson or Gson

Hello guys, If you are working with JSON data then you may know that JSON is collection of key value pairs and that's why many times, you also need to convert them into a Map in Java. While there are many Java libraries like Jackson and Gson which provides support of parsing JSON to Java objects, there is not much support for JSON parsing or manipulation on standard JDK. While JSON parsing is still a long overdue, starting with JDK 8u60+ the built-in Nashorn engine is capable to convert JSON content into java.util.Map. No external dependencies are required for parsing JSON in to Map as you will learn in this article. 

Top 10 Online Courses to Learn Python in 2024 - Best of Lot

Hello guys, if you want to learn Python programming language in 2024 and are looking for the best Python courses, you have come right. There are a lot of resources to learn Python on the web, including free and paid. In the past, I have also shared a lot of accessible sources like free books,  tutorialscourses, specialization, and certifications. Still, many of you asked for more comprehensive and advanced Python courses to master this essential programming skill in 2024. We have selected a few advanced Python online training courses from platforms like UdemyCoursera, edX, ZTM Academy, and Pluralsight to help you learn Python from the best resources. 

Can You Override static method in Java? Method Hiding Example

Can we override the static method in Java?
This is one of the most popular Java interview questions. The answer to this question is No, you cannot override the static method in Java because the method overriding is based upon dynamic binding at runtime and static methods are bonded using static binding at compile time. This means static methods are resolved even before objects are created, that's why it's not possible to override static methods in Java. Though you can declare a method with the same name and method signature in the subclass which does look like you can override static methods in Java but in reality that is method hiding. 

Top 95 Programming Interview Questions Answers to Crack Any Coding Job Interview

Hello guys, if you are preparing for your next Programming Job interview and looking for frequently asked Coding or Programming questions to practice then you have come to the right place. In this article, I am going to share some of the most commonly asked Coding questions from Programming Job interviews. In order to do well on the Coding interview you need practice, you just can't go there and try to solve the coding problems in a limited time, that's actually one of the most common reasons to fail your programming Job interviews.  Sometimes, the interviewer also asks a little bit easier coding questions on a telephonic interview like revering array in place or reversing a string in place.

Top 5 Free Object-Oriented Programming Courses for Java Programmers in 2024 [UPDATED]

The OOP or Object Oriented Programming paradigm allows you to write a program by modeling real-world things in terms of class and object. It makes representing a real-world thing in the programming world smoother and will enable you to manage the complexity of your program. Even though several programming paradigms, like procedural and functional, most of the code we write today is object-oriented. Some of the most popular programming languages are object-oriented, like Java, Python, PHP, and JavaScript, all supported object-oriented programming.

Top 10 Free Courses for Java Developers to Learn Online in 2024 - Best of Lot

Hello guys, the Internet is full of useful resources, and no matter what you want to learn, there is something useful available for free. You just need to commit your time and effort. But at the same time, it's challenging to choose from the massive sea of free tutorials and courses on the internet. If you are not careful, you will spend most of your time browsing and changing classes without learning anything. That's where a curated list helps. Curation is my hobby and passion. I love to read books and courses which allows me to curate useful resources and share them with you guys.

Top 30 Stack and Queue Data Structure Interview Questions for Practice

Hello guys, stack and queue are two fundamental data structures which are used on many applications and algorithms. For example, you can use stack to convert a recursive algorithm to iterative one, which is more safe in production and no risk of StackOverFlowError. Similarly, queue is used in many asynchronous algorithms like producer consumer pattern or publish subscribe pattern to exchange messages. Because of that, they are also quite popular on coding interviews, particularly on Java developer interviews. In the past, I have shared 100+ data structure questions as well as String coding problems, array questions, linkedlist questions, recursion questions and even dynamic programming questions but I have not shared stack and queue related questions before. 

Top 5 Java Performance Courses for Experienced Developers in 2024 - Best of Lot

Hello guys, if you have been doing Java development for few years, then you know that Performance is the key for any Java application. As a senior Java developer, one should know how to improve the performance of Java applications and understand memory management and garbage collection, which often causes Performance in Java applications. These are some advanced skills that take some effort to develop. It doesn't come by default even if you have been programming in Java for years, as most people don't touch these topics. Many of them are afraid or take the performance tuning work and always look up to the most senior or brilliant developers in their team.

Top 7 Free Amazon Web Services or AWS Courses to Learn in 2024- Best of Lot [UPDATED]

Hello guys, if you are thinking about learning cloud technologies or cloud computing, and looking at the various cloud providers like AWS, GCP, or Azure, then you are going in the right direction. The future lies with Cloud, and it's essential for every developer to learn about cloud computing solutions. When we talk about Cloud, the first thing that comes to mind is AWS, the biggest Cloud Computing platform, and that's why I suggest a lot of developers learn it. If you want to learn Amazon Web Services, popularly known as AWS, and looking for some excellent resources like books, courses, and tutorials, then you have come to the right place.

Top 10 Online Courses to Learn Data Structure and Algorithms in 2024 - Best of Lot

Hello guys, In the past, I have shared a lot of useful resources like books and tutorials to learn Data Structure and Algorithms for both beginners and experienced programmers. I have also shared a lot of Data Structure and Algorithmic interview questions like this and their solutions in Java. Still, I have got continuously queries about excellent online courses to learn Data Structure and Algorithms in Java. Even though the topics are completely independent with the programming language, Java developer definitely likes the online courses which teach Data Structure and Algorithms in Java, and that's why my recent post about best algorithms courses, which includes algorithms courses from JavaScript and Python didn't impress my readers.

Top 10 Free Core Spring, Spring MVC, and Spring Boot Courses for Beginners in 2024 - Best of Lot

Hello guys, if you want to learn Spring Framework, Spring MVC and Spring Boot then you are at the right place. In this post you will find the best free courses to learn Spring Framework, Spring MVC and Spring Boot in 2024. I have been sharing a lot of resources like books and courses recently and when I published my list of Top 5 courses to learn Spring and Hibernate, many of my readers asked about a similar list of free courses to learn Spring Framework like Core Spring, Spring MVC, Spring Security, and Spring Boot. That request was always back in my mind but I couldn't get time to put together a list, which I can share with you guys, but today is the day. In this list, I have compiled some of the best online free courses to learn Spring Framework from scratch, online at your own pace. 

Top 5 System Design Newsletter You Can Read in 2024

Hello guys, if you want to learn System design then there are many ways you can start. For example, you can start with reading a System Design book, or joining an online course, but if you want to keep yourself updated and believe in constant learning then there is no better way then subscribing to a System Design Newsletter. When it comes to System design newsletter you can find many newsletter online, just open your LinkedIn and you will see a post popping here or there but you cannot subscribe to all of them as it doesn't make sense. A better strategy is to subscribe only the best newsletters so that you doesn't get overwhelmed but also keep learning useful concepts and new tech trends. 

8 Free Linux Courses for Programmers and IT Professionals to Learn Online [2024]

Linux is one of the most popular operating systems to run server-side applications. I have seen almost all Java applications running on Linux, barring a couple of them, which run on Windows as a service. If you take out standalone apps like IDEs or tools, most of the real-world Java applications run on Linux, like payment gateways, trading systems, and other financial applications. That's why it's essential for any programmer, IT professional, or developer to learn and understand Linux, both the operating system, as well as the command line.

Top 10 JavaScript Online Courses for Beginners in 2024 - Best of Lot

Hello guys, JavaScript is one of the most powerful programming languages, and if you want to learn JavaScript, now is the best time. If you are looking for the best and advanced JavaScript courses, then you have come to the right place. Earlier, I have shared JavaScript websites, JavaScript projects, and free JavaScript courses, and in this article, I am going to share some of the best courses to learn JavaScript in 2024. I have compiled this list by collecting a lot of recommended JavaScript courses from online learning platforms like Udemy, Coursera, Pluralsight, Educative, CodeCademy, edX, Udacity, and others. This is a decent collection of different types of JavaScript courses from different platforms. While you don't need to join all these courses, joining one or two will be enough. 

Top 8 Online Courses to Learn Power BI in 2024 - Best of Lot

If you want to become a Data Analyst or Data Scientist or you are doing Data Analytics and Data visualization and want to learn Microsoft Power BI then you have come to the right place. In the past, I have shared the best courses to learn Tableau, QlikView, D3.js, and Excel, and today and I going to share the best online courses to learn Microsoft Power BI, another top-class Data Visualization tool. If you have been interested in Data Visualization and Analysis then you might have come across Microsoft Power BI, a cloud-based powerful data visualization tool that is quickly getting very popular among Business Analysts and other technical people who work with Data.

Top 6 Free Database and SQL Query Courses for Beginners to Learn Online in 2024 - Best of Lot

Hello guys, I have been sharing some free programming resources e.g. books and courses in this blog for quite some time. Earlier I have shared free courses on Java, Maven, Spring, and Data Structure and Algorithms and today I'll share some of the free online training courses to learn SQL and Database. Why you should learn SQL? Well, it's one of the must-have skills for programmers, application developers, and IT professionals. Like Linux, this is one skill that is going to serve you longer than any other programming language, framework, or library. 

Top 7 Free Online Courses to learn JavaScript in 2024 - Best of Lot

Hello guys, If you want to learn JavaScript in 2024 by yourself and looking for some free resources like books, sites, and tutorials, then you have come to the right place. Earlier, I have shared the best JavaScript online courses to learn JavaScript in depth and In this article, I am going to share some of the best free JavaScript online courses you can join to learn JavaScript by yourself, on your own schedule, and at your own place. A lot of people are learning JavaScript, and the number is only increasing with each passing day, and why not? It's the #1 web development language. It got tons of useful frameworks and libraries like Angular, React Node.js, and jQuery, which makes web development really easy.

Top 6 Online Courses to Learn Linux and UNIX in 2024 - Best of Lot [UPDATED]

Hello guys, if you want to learn Linux operating systems and command lines and look for the best Linux courses, you have chosen the right place. In the past, I have shared some free Linux courses and bash scripting courses for programmers and developers, and many of you asked for more comprehensive online Linux courses to learn Linux in-depth, which motivates me to write this article. In this article, you will find the best Linux online training classes, online paths, and tutorials from Udemy, Pluralsight, Coursera, and edX, my favorite online learning platforms.  

7 Free Blockchain Developer Courses and Certifications to Learn in 2024 - Best of Lot

Hello guys, if you want to learn Blockchain development and are looking for some free Blockchain courses, you have come to the right place. Earlier, I shared my favorite and best blockchain courses for programmers, and a lot of you asked for free online courses to learn Blockchain, so today, I am going to share the best free Blockchain development courses you can join in 2024. Blockchain is one of the most in-demand technologies and one skill that you should learn in 2024. It will not only help in your career but also raise your profile. This is one thing I have highly recommended programmers to learn this year. 

Top 10 Data Science and Machine Learning Courses, Certifications in 2024 - Best of Lot

Suppose you work in the technology field today as a programmer or software engineer. In that case, I am sure you have heard about terms like Data Science, Machine Learning, Deep Learning, Artificial Intelligence, etc. They are the latest technologies impacting every single sector, just like IT does it when it comes the first time. It doesn't matter if you work for a bank or insurance sector, airspace, or defense. All fields were impacted by IT, and shortly, they will be affected by machine learning and artificial intelligence. That's why it's essential to learn Data Science and Machine learning in 2024, and if you are looking for some good resources like courses and certification, you have come to the right place.

Top 6 JavaScript Data Structure and Algorithm Courses for Beginners to Learn in 2024 - Best of Lot

Hello guys, if you are a JavaScript developer learning Data Structure and Algorithms and looking for the best online course to learn Algorithms and Data Structure in JavaScript, then you have come to the right place. In the past, I have shared free classes to learn JavaScript and data structure Algorithmsand today, I will share the best courses to learn Data Structure and Algorithms. These courses have been created by expert instructors like Colt Steele, Andrei Neagoie, and Stephen Grider and are trusted by thousands of developers. They are also very affordable, especially the Udemy courses you can buy for just $10 on Udemy sales which happens every now and then.

Top 5 Courses to learn MERN Stack in 2024 - (MongoDB, Express.js, React.js, and Node.js) Best of Lot

The popularity of the MERN stack development has grown significantly in recent years. The MERN stack is one of the two popular JavaScript stacks, along with the MEAN stack, and is used to develop single-page dynamic web applications. While I am a big fan of Java + Spring Boot stack, if I have to choose a non-Java stack then I always go for MERN stack because of React.js. This is one of the modern framework which completely changed how you create frontend in JavaScript and that's why more and more companies are using React.js and MERN stack for their web app development. 

Top 10 Udemy Courses for Java Developers in 2024 - Best of Lot

Hello guys, if you are looking for best Udemy courses to learn Java and Spring Framework then you have come to the right place. Earlier, I have shred best Pluralsight courses for Java developers and best LinkedIn Courses for Java developers and today, I will share best Udemy courses for Java developers in 2024. Before we get to the important part and give you a list of the best courses that you can use to become expert Java programmers, let us start with the basics first. What is Java? In the most basic of terms, Java is a general-purpose, object-oriented, and class-based programming language that is known for having lesser implementation dependencies.

3 ways to check if checkbox is selected in jQuery - Example Tutorial

 So, you have a checkbox and you want to check if its selected or not at runtime using jQuery. If that's what you want then continue reading. A checkbox is an HTML element with type="checkbox" and checked property is used to find out whether a checkbox is selected or not. There are several ways to find if your checkbox has this property or not in jQuery e.g. by using :checked, a pseudo selector or by using is() jQuery function or by using prop() function which is available from jQuery 1.6 onward. In this article, we will see examples of these approaches to check if a check box is checked or not. 

Top 7 Spring Boot Online Courses for Beginners in 2024 - Best of Lot [UPDATED]

Hello guys, if one of your goals is to learn Spring Boot in 2024, and I have started working towards it. As I have talked about my 3 point action plan to learn new technology, the first step is to attend some online courses and start building from that. If you are not sure what is Spring Boot and why should you learn Spring Boot, then let me tell you that it should be the first Java framework you should learn in 2024. The Spring Boot makes it really easy to work with the Spring framework by removing all the starting hurdles concerning setup and configuration. In one word, it makes it possible to write a Spring-based Java application and run them like core Java applications, like from the primary method.

Top 10 Frequently asked SQL Query Interview Questions Answers

In this article, I am giving some examples of SQL queries which is frequently asked when you go for a programming interview, having one or two year experience in this field. Whether you go for a Java developer position, QA, BA, support professional, project manager, or any other technical position, may interviewer expects you to answer basic questions from Database and SQL. It's also obvious that if you are working for one or two years on any project there is a good chance that you come across to handle databases, writing SQL queries to insert, update, delete and select records. 

Top 15 Courses to Learn System Design and Software Architecture in 2024 - Best of Lot

Software design or System design is one of the tricky concepts to master. You can quickly learn a programming language like Java or Python, but creating software using that programming language is a totally different thing. That's where software design and coding skills come to the rescue. It's actually an art to structure your program, design your modules, specify boundaries and interactions with other parts of the system so that they are easier to read, maintain, and flexible to change. It's one of the most essential skills for a software developer but often gets ignored. If you look for an online course to learn Software design and architecture, you won't find many, forget about good ones.

Top 100 Data Structure and Algorithm Interview Questions for Java Programmers

Data structure and algorithms are a core part of any Programming job interview. It doesn't matter whether you are a C++ developer, a Java developer, or a Web developer working in JavaScript, Angular, React, or Query. As a computer science graduate, it's expected from a program to have strong knowledge of both basic data structures, like the array, linked list, binary tree, hash table, Stack, Queue, and advanced data structures like the binary heap, trie, self-balanced tree, circular buffer, etc.

Top 10 Books Java Developers Must Read

Hello guys, If you are a Java developer and wondering what to read, 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 21 features, and Spring 6 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

How to Reverse words in String Java? [Solution]

Hello guys, if you are wondering how to reverse words in a given String in Java then you have come to the right place. Earlier, I have shared 75 Programming interview questions and In this Java Coding tutorial, you will learn how to reverse words in String. It's also one of the popular coding questions, so you will also learn how to take a requirement, how to fill gaps in the requirement by asking the right question. A String is nothing but a sentence, which may contain multiple works, or just contain a single word or it may be empty. Your program must produce a String that contains the word in reverse order, for example, if the given input is "Java is Great" then your program should return "Great is Java".  

Top 5 Cloud Computing Books for Beginners to Read in 2024 - Best of Lot

Hello guys, if you want to learn Cloud Computing in 2024 and looking for the best online resources like books, online courses, tutorials, and websites then you have come to the right place. Earlier, I have shared the free cloud computing courses and best websites for cloud computing, today, I am going to share the best book to learn about Cloud computing in 2024. These books are written by Cloud Computing experts and trusted by thousands of people who want to learn Cloud Computing and public cloud platforms like AWS, GCP, and Microsoft Azure. You can read one or more of these book to get started with Cloud Computing and benefits it offer in terms of cost saving, scalability, and high-avaibility. 

How to remove duplicates from Collections or Stream in Java? Stream distinct() Example

Hello guys, if you wonder how to remove duplicates from Stream in Java, don't worry. You can use the Stream.distinct() method to remove duplicates from a Stream in Java 8 and beyond. The distinct() method behaves like the distinct clause of SQL, which eliminates duplicate rows from the result set. The distinct() is also a standard method, which means it will return a new Stream without duplicates, which can be used for further processing. Like other methods of Stream class, I mean, map(), flatmap(), or filter(), distinct() is also lazy, and it will not remove duplicate elements until you call a terminal method on Streams like collect or forEach().  

Top 10 Algorithms books Every Programmer Should Read

Algorithms are language agnostic, and any programmer worth their salt should be able to convert them to code in their programming language of choice. Unfortunately, I have come across several programmers who are REALLY good at programming languages like Java or Python, like know minor details of API and language intricacies but have very poor knowledge of the fundamentals of Algorithms and Data Structures. Just ask them to implement any popular sorting algorithms like quicksort or merge sort, and they will fall apart. If you expect them to know more advanced and sophisticated algorithms like String processing algorithms, graph algorithms, tree traversal, or greedy algorithms, be ready to check on Interviews; otherwise, you might end up with some surprises.

10 Books and Courses to Prepare Technical Programming/Coding Job Interviews in 2024

If you are preparing for a technical interview in the software development sector and looking for some great books to boost your preparation, then you have come to the right place. In the past, I have hared some of the best online courses to prepare coding interviews. In this article, I am going to share some of the best programming/coding interview books to prepare well for any software development jobs. These books are enough to crack even the toughest of the job interviews at GoogleAmazon, or Microsoft. They provide excellent coverage of all essential topics for programming job interviews like data structure and algorithms, system design, algorithm design, computer science fundamentals, SQL, Linux, Java, Networking, etc.

5 Examples of map() and flatMap() in Java 8 Stream

The map() and flatMap() are prince and princess of functional programming in Java. They are two powerful methods of Stream API which I believe every Java developer should be aware of and should also master it. You can use map() and flatMap() for data transformation, dealing with database operations where you need to convert one object to another while saving or reading from database. You can also use them for parsing and formatting as well as when you want to remove boiler plate code and make your data pipeline concise. The map() function is used in functional programming to transform each element of Stream into another element. 

Top 21 String Programming and Coding Interview Questions With Solutions

In this article, I am going to share 21 of the most common String-based Programming and Coding interview questions from Java developer interviews. These questions require you to write code to solve the problem and they are different from traditional Java String questions like how the substring method works in Java? or when to use the intern() method of String in Java? Since coding and problem solving are an important part of any programming job interview, it's imperative that you know how to solve them in time and in a pressure situation, which comes only after doing practice with the right set of questions. Since these questions are already tried and tested and appeared in many interviews, they will provide you the experience you need to crack your coding interview.

Top 21 jQuery interview Questions and Answers

Hello guys, if you are preparing for web developer interviews then preparing for jQuery questions can benefit you. While many people will say that jQuery is dead but its not dead and I am still working with projects which are using jQuery for little to big things. That's why its important to know about basic jQuery concepts and interview questions based upon that. In the past, I have shared several JavaScript and web development interview questions and in this article I am going to share jQuery questions like what is $() etc. What are selectors? how does they work etc. You can use this questions to quickly revise key jQuery concepts for interviews.  So what are we waiting for, let's see the basic jQuery interview questions for web developers.

Top 21 Maven Interview Questions Answers for Java Developers

Hello guys, for a Java developer, Maven in one of the essential tool and its used to build your Java application. Since most of the Java projects used Maven for building, it is expected from a Java developer that he knows Maven and knows it well. That's why Maven questions are quite common on Java developer interviews but I have seen many Java programmers coming to these interview unprepared and not able to answer most of the questions on tools like Maven, Gradle or even git. When I asked one candidate why don't you prepare for Maven before your Java interviews, he said, I wasn't able to find any list of Maven questions. 

How to enable or disable form elements using jQuery? Examples

In last couple of tutorials you have learned how to get all selected checkbox and radio buttons, and in this tutorial, you will learn how to enable/disable form elements using jQuery. A form element e.g. a textfield, radio buttons and checkbox, all represented using input tag can be enabled or disabled by adding an attribute called "disabled". It's similar to "checked" attribute we have seen for checkbox and radio buttons. If this attribute is not present then element is enable, but if this attribute is present then you can use disabled=true to disable the form element and disabled=false to enable the form elements as shown in our example. Like previous example of checking/unchecking checkbox, you can use prop() jQuery function to enable/disable form element if you are running on jQuery 1.6 or higher version and attr() function if you are running on jQuery 1.5 or lower version. 

How to shuffle a List in Java? Collections.shuffle() Example

Hello guys, if you have a List of numbers and you want to shuff it but don't know how then you have come to the right place. Shuffling is an important technique which is used quite a lot on coding games like number guessing games and card games., The java.util.Collections class provides shuffle() method which can be used to randomize objects stored in a List in Java. Since List is an ordered collection and maintains the order on which objects are inserted into it, you may need to randomize elements if you need them in a different order. Collections.shuffle() method uses default randomness to randomize elements but you also have an overloaded version of shuffle() to provide an instance of the java.util.Random object, which can be used to randomize elements.

How to Compare Two Dates in Java? Check If They Are Equal, Later or Earlier - Examples

There are multiple ways to compare two dates in Java, it also depends on what exactly comparison means. If you are looking to compare two dates to find out whether they are equal or not, then you can simply use the equals() method of java.util.Date class. This method will return true if both dates are equal, precisely both have the same millisecond value. If you are looking to find out whether a date comes before or after another date then you have 3 choices, you can use the compareTo() method of java.util.Date class, or you can use before() and after() method of Date class, or you can use before() and after() method of Calendar class. I suggest leveraging the before() and after() method of the Date class, they are more readable and easy to use.

What is transient variable in Java? Serialization Example

What is a transient variable in Java?
transient variable in Java is a variable whose value is not serialized during Serialization and which is initialized by its default value during deserialization, for example for object transient variable it would be null. This behavior can be customized by using a custom Serialized form or by using the Externalizable interface. A transient variable is used to prevent any object from being serialized and you can make any variable transient by using the transient keyword. You cannot make a local variable transient through and it's only the member variables which can be transient. 

Difference between HashSet and HashMap in Java? Answered

HashSet and HashMap in Java
Hello friends, if you have given Java developer interview then there is good chance that you may have come across questions like Difference between HashSet vs HashMap or HashSet vs TreeSet etc. In this article, we are going to discuss differnece between HashMap and HashSet, two of the popular Collection classes from JDK. The HashSet vs HashMap is a classical Java Collection interview question that focuses on What are differences between HashSet and HashMap in terms of features, usage, and performance. If you are in Java programming even for a year or so, you are likely to be familiar with What is HashSet in Java and What is HashMap in Java, these two are the most popular collection classes. 

What is PATH and CLASSPATH in Java? Path vs ClassPath Example

What is PATH and CLASSPATH in Java
The PATH and CLASSPATH are the two most important environment variables of the Java environment which are used to find the JDK binaries used to compile and run Java in windows and Linux and class files which are compiled Java bytecodes. From my personal experience I can say that PATH and CLASSPATH are the two most problematic things for beginners in Java programming language due to two reasons; first because in most Java courses nobody tells details of what is a PATH and CLASSPATH, What do PATH and CLASSPATH do, What is meaning of setting PATH and CLASSPATH, What happens if we do not set them, Difference between PATH vs CLASSPATH in Java or simply How Classpath works in Java, etc. 

Why is main method public, static, and void in Java? Answer

What is the main method in Java?
The main() method in Java is a special method that is used by JVM to start the execution of any Java program. The main method is also referred to as the entry point of Java application which is true in the case of core Java applications because execution starts from the main() method, but in the case of container-managed environments like Servlet, EJB, or MIDlet this is not true as these Java programs have their own life-cycle methods like init(), service() or destroy() for Servlet's which is used by the container. The main method in Java is run by the main thread which is a non-daemon thread and the Java program runs until the main method finishes or any other user thread is running. 

How to convert JSON String to Java Object using Gson? JSON Deserialization Example

Hello Java Programmers, In the last article, you have learned how to convert a Java object to JSON String and in today's article, you will learn the opposite, i.e. converting a JSON String to a Java object. The first example was known as JSON serialization example and this one is known as JSON deserialization because we are creating a Java object from a String. The idea is very similar to classical Serialization in Java where you convert a Java object to another binary format that can be transported over the network or can be saved in the disk for further usage.

Difference between var, val, and def in Scala? Examples

Hello guys, if you are new to Scala or preparing for Scala interview then you may have come across the question, what is difference between var, val, and def keywords in Scala? This is one of the frequently asked questions from Scala interviews. Even though both var and val keyword is used to declare variables in Scala there is a subtle difference between them. A var is a variable. It’s a mutable reference to a value. Since it’s mutable, its value may change throughout the program's lifetime. On the other hand, the val keyword represents a value. It’s an immutable reference, meaning that its value never changes. Once assigned it will always keep the same value.

3 ways to convert String to JSON object in Java? Examples

It's very common nowadays to receive JSON String from a Java web service instead of XML, but unfortunately, JDK doesn't yet support conversion between JSON String to JSON object. Keeping JSON as String always is not a good option because you cannot operate on it easily, you need to convert it into a JSON object before you do anything else e.g. retrieve any field or set different values. Fortunately, there are many open-source libraries which allows you to create JSON object from JSON formatted String like Gson from Google, Jackson, and json-simple. In this tutorial, you will learn how to use these 3 main libraries to do this conversion with step-by-step examples.

Difference between Correlated and Non-Correlated Subquery in SQL? Examples

Hello guys, the difference between correlated and non-correlated subquery is one of the popular SQL interview question and an important concept for any programmer to learn. The correlated subquery is one of the tricky concepts of SQL. It's similar to recursion in programming which many programmers struggle to understand, but like recursion, it also offers the unique capability to solve many SQL query-based problems like the second-highest salary problem where you need to compare one row of the table to another row. It gives you a different kind of power. The main difference between a regular, non-correlated, and correlated subquery in SQL is in their working, a regular subquery just runs once and returns a value or a set of values that is used by the outer query.

How to sort ArrayList in Java? Examples

Hello Java programmers, sorting ArrayList in Java is not difficult; there are multiple ways to sort a given ArrayList in Java. For example you can use  the Collections.sort() method to  sort ArrayList in ascending and descending order in Java. The  Collections.sort() the method optionally accepts a Comparator. If provided, it uses Comparators' compare() method to compare Objects stored in Collection to compare with each other; in case of no explicit Comparator, Comparable interfaces' compareTo() method is used to compare objects from each other. If objects stored in ArrayList don't implement Comparable, they can not be sorted using the Collections.sort() the method in Java.

What is final modifier in Java? fina class, method, and variable example

Hello Java Programmers, the final variable is a very important concept in Java. It's a modifier that you can apply on variables, methods, and classes and when you apply the final modifier it can make variables immutable, prevent the method from overriding in subclasses, means no polymorphism, and when you make a class final in Java it cannot be extended anymore, taking out Inheritance from the picture. There are both pros and cons of using the final modifier in Java and that's why it's very very important for a Java developer to have an in-depth knowledge of the final modifier in Java and that's what you will learn in this article. 

Best way to Convert Integer to String in Java with Example

Integer to String conversion in Java
There are many ways to convert an Integer to String in Java e.g. by using Integer.toString(int) or by using String.valueOf(int), or by using new Integer(int).toString(), or by using String.format() method, or by using DecimalFormat, String concatenation, or by using StringBuilder and StringBuffer, etc but which one is the best? Some of them we have already seen on my earlier posts e.g. how to convert int to String and converting double to String.  Well, we are going to find the best way to convert Integer to String in Java in this post. 

How to create a ZIP File in Java? ZipEntry and ZipOutputStream Compression Example

Since compressing and archiving old log files is an essential housekeeping job in any Java application environment, a Java programmer should know how to compress files in .zip format and then how to read them programmatically if required. The JDK provides full support to create and read ZIP files in Java. There is a separate package java.util.zip to hold all classes related to zipping and unzipping files and streams. In this series of articles, you will learn how to use those classes like ZipFile, ZipEntry, ZipInputStream, and ZipOutputStream, etc. 

How to add JAR files in Eclipse Project's Build path? Example

In this Java Eclipse tutorial, I will show you two ways to add external JAR files in Eclipse Java projects. Many times we need to use external JAR files in our Java application for different needs like for general purposes you may use Google Guava or Apache Commons. If you are using Spring or Hibernate framework then you need their JAR files as well. In order to use any third-party library or framework, we have to add their JAR files in the classpath, to compile and run our Java programs. Since Eclipse is the most popular IDE for developing Java applications, it's important to know how you can add external JARs into your Java project's build path. 

5 Tips to Fix Exception in thread "main" java.lang.NoClassDefFoundError in Java, Examples

NoClassDefFoundError in Java
The Exception in thread "main" java.lang.NoClassDefFoundError is a common error in Java that occurs if a ClassLoader cannot find a particular class in the classpath while trying to load it. The Exception in thread "main" suggests that this error has occurred in the main thread, the thread which is responsible for running the Java application. This error can occur to any thread, but if it happens in the main thread, then your program will crash because Java program runs only until main() thread is running or any other non-daemon thread is running. As per Javadoc, NoClassDefFoundError can be thrown during the linking or loading of the class file

14 Enum Interview Questions and Answers for 1 to 2 Years Experienced Java Programmers

Hello Java developers, Java Enum is one of the best features of Java Programming language which was first added on the JDK 1.5 Tiger release along with Generics, Autoboxing, and varargs. While the concept of Enum was also present in C Programming language, in Java its much more powerful. Enum in Java represents a fixed number of well-known things like the number of days in a week, the number of months in the calendar year, etc. Unlike C and C++ Enum in Java are much powerful and they are not an integer constant, Instead, Enum is a Type in Java like class or interface which provides compile-time type safety. In this Java Enum tutorial, we will see a couple of important points about Java Enum which help to understand Enum better and get the most out of it. 

How to convert String to char in Java? Example Tutorial

Hello Java Programmers, if you are wondering how to convert a String to char value in Java then you have come to the right place. Earlier, we have seen how to convert a character to String in Java and today we'll learn opposite i.e. converting String object to a character value. You know the difference right? String is an Object while char is a primitive value. So here we are also going to convert a Java object into a primitive value. By the way, this conversion only make sense if String is a single character. For example, you have a String with value "s", how do you convert that to a char 's' in Java (FYI, string literal are quoted inside double quotes in Java, like "c" and character literals are quoted inside single quotes e.g. 'c' in J)? Well, if you know, Java String is made of a character array and java.lang.String class provides a method toCharArray() to retrieve that character array.

How to get current TimeStamp value in Java? Example

Do you know that Java developer Google (now ask ChatGPT) for even the simplest of things? Yes, that's true and I can say it because even I do that :-). Finding the current timestamp value is one of them. In UNIX you can just use the date command to get the current date and time but how do you get that in your Java program? Well, you can get the current timestamp in Java by using the Date and Timestamp class of JDK. Note, there is "s" instead of "S" in Timestamp. Since Date in Java contains both date and time, it can be used as a Timestamp value as well but when you print Date, it shows time in the local timezone

5 Difference between String, StringBuffer, and StringBuilder in Java

Difference between String, StringBuffer, and StringBuilder is probably one of the oldest yet most popular interview question in the history of Java developer interviews. I have personally asked this question almost 4 to 5 times. You will find this question on any list of Java interview questions. I have also included this in my earlier list of core Java questions and Java String questions. If you are preparing for Java interviews, those are handy resources. Now coming back to the answer, although all three classes StringBuffer, StringBuilder, and String are used for representing text data in Java there are some significant differences between them. One of the most notable differences between StringBuilder, StringBuffer, and String in Java is that both StringBuffer and StringBuilder are Mutable classes but String is Immutable in Java. What this means is, you can add, remove or replace characters from StringBuffer and StringBuilder object but any change on the String object like converting uppercase to lowercase or appending a new character using String concatenation will always result in a new String object. 

Difference between include() and forward() methods of RequestDispatcher in Servlert

What is the difference between include and forward methods of RequestDispatcher interface is one of the frequently asked Servlet questions from Java EE interviews and we'll see how you can answer this question on your interview. You get the RequestDispatcher reference either from ServletContext or ServletRequest interface and even though both include() and forward() method allow a Servlet to interact with another servlet, the main difference between include() and forward is that the include() method is used to load the contents of the specified resource (could be a Servlet, JSP, or static resource like HTML files) directly into the Servlet's response, as if it is part of the calling Servlet. 

Base64 Encoding and Decoding Examples in Java 8 and Before

Though, there are a couple of ways to Base64 encode a String in Java e.g. by using Java 6's javax.xml.bind.DatatypeConverter#printBase64Binary(byte[]) or by using Apache Commons Codec's Base64.encodeBase64(byte[) and Base64.decodeBase64(byte[])as shown here, or the infamous Sun's internal base64 encoder and decoder, sun.misc.BASE64Encoder().encode() and sun.misc.BASE64Decoder().decode(), there was no standard way in JDK API itself. That was one of the few missing item (another one is about joining string) which is addressed in Java 8.

How Java achieves platform independence? Answer

Java is a platform-independent language How?
Java a programming language provides platform independence, what does it mean? It means the same Java program can be run on any platform or operating system like Windows, Linux or Solaris without any change. This is a great benefit for someone coming from a platform-dependent programming language like C or C++ whose code needs to be ported for every single platform because they use native libraries, which differ in every platform. Now the question comes how Java achieves platform independence, what makes Java programs running on every platform without any change

10 Difference between Struts 1.x and Struts 2.x framework in Java

What is the difference between Struts 1 and Struts 2 is one of the popular Struts interview questions from Java JEE interviews? If you have mentioned Struts in your CV then you can expect this question on the telephonic or face-to-face round of interviews. Struts 1.x was a very popular MVC framework for Java web applications in the last decade, but when Spring MVC comes it lost a lot of its sheen. Spring framework's dependency injection and inversion of control feature, along with several other template-based features makes it the de-facto framework for developing Java applications. 

When You should Not use Microservice Architecture? (Answer)

 Hello guys, recently while giving interview in one of the big US based Investment bank I was asked about, what are the scenarios when you shouldn't be using Microservices architecture? When I hear this question I was big surprised not because I didn't know the answer but because most of the people ask about using Microservice architecture and this was the first time I am hearing otherwise. To be honest, it's a good question because most of the candidate will prepare about benefirst about Microservice architecture and they may not know when it's not appropriate to use it. Since I have worked in low latency high frequency application, I knew that multiple process means more latency so clearly a Microservices is a big no if you are working on a high frequency low latency application. In those cases you want to do all your calculations inside a single thread or process without even swapping memory to avoid delay. Hence the first answer to this question was, you shouldn't be using Microservice in a low latency application. 

Difference between static and instance member variables in Java? Answer Example

Hello Java Programmers, In the last article, I had explained some key differences between static and nonstatic methods in Java, and in this part, I'll explain the difference between static and nonstatic member variables in Java. The concept of static remains the same, that doesn't change with method or member variables but there are still some subtle details, which every Java programmer should know and understand. As with static methods, a static member variable belongs to a class and a non-static member variable belongs to an instance. 

3 ways to check if a String contains SubString or given Character in Java? IndexOf, contains, and lastIndexOf Example

You have given a String and a subString or a character and you need to find out whether given String contains the given character or substring, how would you do that? Well, there are three main ways to search String in Java, the contains() method, the indexOf() method and the lastIndexOf() method, all from java.lang.String class. First method, contains() accepts a CharSequence, superclass of String and return true if that CharSequence appear on the String you have called. The indexOf() and lastIndexOf() are similar method and both return the index (zero based) from where the given subString or character appear in the String you have called. Only difference between indexOf() and lastIndexOf() is that if given substring appear multiple time then they will return difference index, otherwise both will return the same index. Similarly if given sub-string is not present in the String, both will return -1 and contains() will return false.

Top 10 Bash + UNIX Interview Questions and Answers

Hello guys, bash is a wonderful command line tool which can be used to automate trivial task. I have written cleanup scripts, start and stop scripts and even schedule jobs using bash and crontab command. Since bash is super useful for anyone running their application in Linux its also a key skill for developers and IT support. Because of that you will always find a couple of questions related to bash on developer interviews. In the past, I have shared Linux interview questions and today I am going to share a couple of bash interview questions which is asked to me throughout the years. If you have worked in bash shell then you can easily answer these questions but if you find it trouble, maybe it's time to revise your bash concepts. 

23 Java Static Class, Methods and Variables Interview Questions with Answers

The static keyword is one of the essential keyword in Java which represent the concept of static in programming. When you make something static, it is averse to change i.e. it is not dynamic and that is true for static variable, methods and class in Java. When you make a member variable static in Java, JVM assumes that the value of that variable will not change between instance and remain same for all objects of that class, hence it is also referred as class variable. Same is true for static methods, which is bonded during compile time because JVM assumes that their definition will not change because they are static and not virtual.

Top 20 Abstract Class and Method Interview Questions and Answers in Java

Both abstract class and abstract methods are very important concepts in core Java and every Java developer should have good understanding of what they are, when to use them and how to use them. They are also very popular on core Java job interviews as well as on Oracle Java certifications e.g. OCAJP or OCPJP. You will often find a lot of code based questions testing essential core Java concepts based upon abstract class and methods in the real exam. All good mock exam simulators e.g. Whizlabs and Enthuware contains a lot of questions testing and explaining these key concepts. In this article, I have collated some of the frequently asked questions about abstract class and abstract methods in Java. You can review these questions before going for Java interview, both telephonic and face-to-face round. They are also very useful if you are preparing for Oracle Java certification e.g. OCAJP.

Top 6 books to learn Java Virtual Machine, Garbage Collection, and Performance [UPDATED]

In the last couple of years, I have seen a trend of many Java developers wants to learn more and more about JVM internals and how Java Virtual Machine and its different component works. This trend was not so strong in the last decade, but with more and more focus on concurrency, performance, and scalability, Java developer is exploring JVM internals, Garbage collection, and Performance tuning in more detail. Unfortunately, there are not many good books to learn about JVM internals and their different components, but fortunately, we have an excellent Java Virtual Machine specification to learn fundamentals. It is also the most up-to-date reference because Java and JVM are kept changing, especially after Java 10.

Top 5 Design Patterns Books for Java Developers - Best of Lot

Design patterns are an essential topic for object-oriented programmers, like Java and C++ developers. It becomes even more important as your experience grows because everybody starts expecting a lot more from you in terms of writing quality code. I often receive emails from intermediate and senior Java developers about progressing to the next level, like how to become Tech Lead, Team Lead, or software architect; knowledge of design patterns plays an important role in taking more technical responsibility. While the GoF book is the bible for object-oriented design patterns, in my opinion, it is a bit too dry and academic.

Top 5 Books to learn SQL and Database Design in 2024 - Best of Lot

SQL (Structured Query Language) is one of the most essential skills of a programmer. I would rate this skill similar to UNIX if you are a professional programmer because it doesn't matter whether you are Java, C++, or a .NET developer, you are bound to write SQL queries. Since a database is an integral part of any modern Java or Web application, the Interviewer always preferred candidates with excellent SQL skills. Now, the big question comes, how a programmer can learn SQL? Does just knowing how to query a table is enough? If you remember, insert, update, delete, and select, then are you a competent SQL programmer?

Top 10 Free Python Programming Books - Download PDF or Read Online

Every Programmer loves free eBook and free courses, even more, if it comes from renowned technical book publishers like Oreilly and Manning. In the last article, I have shared some of the best free Java programming books, and today I am going to share some of the equally best free Python Programming books. These books are not illegal copies that are uploaded into the internet, but they are legal books, made free by their authors and publishers, much like free Udemy courses, which their instructor made free for educational and promotional reasons. Though these are not full-fledged books but concise eBooks, they are very informative and comprehensive enough to learn things like Data Science and Functional programming in Python.

Top 6 Django Python Courses for Beginners to Learn Online in 2024 [UPDATED]

Hello guys, if you want to become a Python web developer and looking for the best online courses to learn Django, Flask, and Python web development, then you have come to the right place. In the past, I have shared the best Python courses and the best Flask courses, and today, I will share the best course to learn everything about Python web development. You may know that Python is a multi-purpose programming language meaning that you can use it in different fields such as GUI application, artificial intelligence, web application, and much more, just to name a few.

Top 7 Free Maven and Jenkins Online Courses for Java Programmers in 2024 [ UPDATED]

Hello Java programmers,  if you want to learn Maven and Jenkins and look for free resources like free online courses, you have come to the right place. Earlier, I have shared the best Maven courses and best Jenkins courses, and in this article, I will share the best free Jenkins and Maven courses for Java programmers. If you have been doing professional Java development, you know that Maven and Jenkins are two of the most popular tools in the Java world. Maven helps organize your project and provide support to build and deploy Java projects, while Jenkins can provide continuous integration and delivery by completely automating build and deploy projects.

Top 5 Books to Learn Hibernate for Java Developers in 2024 - Best of Lot

Hello guys, if you want to learn Hibernate and looking for the best Hibernate books to start with then you have come to the right place. In the past, I have shared the best Hibernate courses and Spring online courses, and today, I am going to share the best books to learn Hibernate for beginners. These books have been created by Hibernate experts like Gavin King, creator of Hibernate himself and it will help you to master this essential Java framework for full-stack developers. Hibernate is the leading ORM (Object to relational) framework in the Java world used to implement the persistence layer of enterprise Java applications.

Top 5 Books to Improve Coding and Programming Skills - Must Read, Best of Lot

Learning a Programming language, like Java, Python, or C++ is easy, but learning to write good code is not. Writing good code is more Art than Science and also an important differentiating factor between an average programmer vs. a good programmer. Since most of the programmers often look for inspiration and resources to improve their coding skill, I decided to share some of the good books which can help them to improve their coding.  Since many universities, colleges, and training courses only teach programming languages but not the art of coding, it still remains one of the self-learned skills which many programmers acquired either in Job or working on real-world projects.

Top 5 Free AWS Developer Associate Certification DVA-C02 Courses in 2024 - Best of Lot

Hello guys, if you are preparing for the AWS Certified Developer Associate exam and looking for free online courses, then you have come to the right place. In the past, I have shared the free online courses to prepare for AWS Cloud Practitioner and SysOps Administrator certifications. Today, I will share free online training courses to prepare for the prestigious AWS Developer Associate exam. The Exam requires hands-on experience with AWS, but that's not enough, you also need to prepare all the exam topics, and that's where these online courses can help you. These are the best and completely free courses from websites like Udemy, Coursera, freeCodeCamp, and Youtube, and you can use them to prepare for this prestigious AWS cloud certification. 

3 Best Books to Learn Java Programming for Beginners

Hello guys, if you want to learn Java from scratch and looking for the best Java books then you have come to the right place. Earlier, I have shared the free Java courses for beginners, and today, I am going to share the best books to learn Java from scratch. There is no doubt that the best book to learn Java for beginners is indeed Head First Java, 3rd Edition. It's interesting, informative, and yet easy to read, which is what a beginner wants. The only drawback of this book was that there is was 3rd Edition available until a couple of months ago but now that drawback has also gone as the 3rd Edition of Head First Java is now available and it covers Java SE 17, the latest version of Java. 

10 Free Courses to Learn Data Structure and Algorithms in Java, Python, and C++ in 2024 [UPDATED]

Algorithms and Data Structure are two of the most fundamental and essential topics in Computer Science, which is used everywhere in software development. I firmly believe that a good knowledge of these two topics is also crucial to becoming a better programmer because a person who has a good understanding of algorithms and data structures can make thoughtful choices and write programs that can handle changes better and perform well. They are also essential to crack coding interviews at top tech companies like Google, Microsoft, Amazon, Facebook, and Apple, which emphasizes candidates' ability to use existing data structures and algorithms to solve complex problems they have never seen before.

Top 10 Books Every Programmer Should Read

There is a saying that if you learn from your mistakes, you will only going to learn few things, but if you learn from other's mistakes, you can learn a lot of things in a short time, and what could be a better way to learn from someone's experience then reading books. Programming as a career is about constant learning and updating yourself, but unfortunately, there is no right way to begin. Schools and Colleges are far behind when it comes to real-world programming, and every Computer Science graduate is not lucky to work in a company that is great in training. The other viable option is to read books, join online courses, and follow advice from the great programmer and authors who are gone on that path, and learning from the book is the most tried and trusted way of all of them.