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. 

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

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. 

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.

Top 5 Courses to learn Web Scraping using Python and JavaScript in 2024 - Best of Lot

Hello guys, you have come to the right place if you want to learn Web Scraping and are looking for the best online courses to learn Web Scraping using Python and other programming languages. Earlier, I shared the best web scraping tools and best scrappy courses. In this article, I will share the best online training courses to learn Web Scraping using NodeJS, JavaScript, Python, and BeautifulSoup. These are the best courses from sites like Udemy and Pluralsight, the best places to learn online. So what is Web Scraping? Web scraping, also known as web harvesting, is a technique used to extract large amounts of data from websites. How does this happen?

Top 5 Books to learn React.js for Beginners in 2024 - Best of Lot

Hello guys, if you want to learn React.js and looking for the best resources like books, online courses, and tutorials then you have come to the right place. Earlier, I have shared the best React courses, websites, roadmap, and projects you can build to learn React.js, and in this article, I am going to share the best books to learn React.js in 2024. From my experience of learning so many techs and programming language, I can say that books are the most complete way to learn. For a better learning experience you can combine those with online courses and projects. For example, you can combine these React books with these best React courses and React projects to become a React Developer in 2024. 

Top 5 Spring Framework Books for Java developers (Includes Spring Security and Spring Boot) - Best of lot

Spring framework is one of the most famous structures in the Java world, which used to develop Java applications, both core Java and web application. It is also one of the most job-oriented skills for Java developers; hence many beginners and intermediate Java programmers try to learn the Spring framework on their own. Though there are some excellent Spring training courses available online, books are still the most popular and preferred way to learn Spring frameworks like Spring core, Spring Boot, Spring MVC, Spring Batch, or Spring Security.  I often receive queries for Spring book recommendations e.g., which Spring book is suitable for beginners, or which Spring book is good for intermediate and advanced developers, which book should I read to learn Spring boot, Spring Cloud, Spring Batch, or Spring security, etc.?

Top 5 Online Courses to Learn HTML and CSS in Depth - Best of Lot

Hello guys, if you want to learn HTML and CSS to become a web designer and developer and are looking for the best HTML and CSS courses, you have come to the right place. In the past, I have shared the best free courses to learn HTML and CSS, and in this article, you have a selection of the best courses you can have to learn a lot about HTML5 and CSS3 online.  This article will share the best HTML5 and CSS 3 online courses from Udemy, Coursera, Pluralsight, and edX for beginners and experienced developers. These online training courses and classes are created by experts and trusted by thousands of developers to learn HTML5 and CSS3 online in 2024

Top 5 Free Angular Courses for Beginners to Learn Online in 2024 - Best of Lot

Google's Angular is one of the most popular JavaScript frameworks for creating web apps. It helps you in creating complex web applications in less time. It's maintained by Google, so you can also rest assured that this powerhouse of a framework is built with speed and purpose and here for the long run. The Angular Framework is also the most popular framework in the world for developing single-page applications.  The framework was first launched as Angular JS, which allowed building a web application using the Model View Controller concept, and it was hugely popular, but it was later re-written completely, which is now known as simply Angular or Angular 2.

Top 10 Java Online Courses and Tutorials for Beginners in 2024 [UPDATED]

Hello everyone! if you want to learn Java Programming and become a Java Programmer in 2024 and looking for the best resources like books, online courses, tutorials, projects, and websites, you have come to the right place. Earlier, I have shared the best Java books for beginners, best Java websites, best Java tutorials, and free Java courses. Today, we will go through some of the best online courses for learning the Java Programming language. These Java online courses are curated from top websites and learning platforms like Coursera, Udemy, Educative, CodeCademy, Javaespecialist, etc. 

Top 5 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 6 Free Courses to Learn TypeScript in 2024 - Best of Lot

If you are interested in learning TypeScript or Angular, one of the popular JavaScript frameworks for developing front-end, which uses TypeScript, and looking for some resources like books, tutorials, and courses, then you have come to the right place. In this article, I am going to share some of the best, free TypeScript online courses you can use to learn this powerful programming language. For those who don't know TypeScript, it's a new dynamically typed programming language from Microsoft that augments JavaScript's programming syntax by adding some new features which help in object-oriented application development, particularly the introduction of Types.

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 5 Free R Programming Courses for Beginners in 2024 - Best of Lot

More and more people are learning the R programming language to become Data scientists, one of the hottest and high-paying technical jobs on the planet. Though I am from Python camp when it comes to choosing between Python and R for Data Science, Machine Learning, and Artificial Intelligence, mainly because of the excellent libraries Python offers, I had tried R for a short time. If you are also in the same boat and want to try or learn R programming for Data Science and machine learning purposes and looking for some excellent free courses to start your journey, then you can take some ideas from this article.

How to replace an element of ArrayList in Java? Example

You can use the set() method of java.util.ArrayList class to replace an existing element of ArrayList in Java. The set(int index, E element) method takes two parameters, the first is the index of an element you want to replace, and the second is the new value you want to insert. You can use this method as long as your ArrayList is not immutable, I mean,  not created using the Collections.unmodifiableList(), in such case the set() method throws java.lang.UnsupportedOperationExcepiton

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 Web 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.

What is the difference between byte and char data types in Java? Example

The byte and char are two numeric data types in Java and both can represent integral numbers in a range but there are very different from each other. The main difference between a byte and char data type is that byte is used to store raw binary data while other is used to store characters or text data. You can store character literals into a char variable e.g. char a = 'a'; A character literal is enclosed in single quotes. In terms of range, a byte variable can hold any value from -128 to 127 but a char variable can hold any value between 0 and 255. 

Difference between Chef and Ansible in DevOps

Hello guys, Ansible and Chef are two popular configuration management tool which are very important in this world of DevOps. What is difference between Ansible, Chef, and Puppet is also a common questions for DevOps and senior Java developer who are also responsible for setting their server and installing application. Earlier, I have shared best DevOps Courses and best online courses to learn Ansible and Chef and in this article, we will go through the difference between two widely recognized configurations management tools used by DevOps engineers i.e. Chef and Ansible.

10 Git Commands Every Programmer Should Learn

Hello guys, Git is one of the most important skill for programmers, developers and data scientist and if you don't know git then you will struggle working in a team. If you want to learn Git in 2024 then you can start with these essential Git commands. I have explained the command and give you example. For examples, I have asked ChatGPT to see how it explains and I was amazed to see the response so I have included here for my own reference. I don't if ChatGPT will remain free forever but I am taking screenshot for the questions which I am asking so that I can keep a record for myself and you in future as ChatGPT is the best instructor I have got today and its helping me to learn and revise several key concepts. 

Difference between ArrayList and HashSet in Java? Answer with Example

ArrayList vs HashSet Java
The main difference between ArrayList and HashSet is that one is a List implementation while the other is a Set implementation. It means all the differences between a List data structure and a Set data structure also apply to this pair. For example, List implementations are ordered, it stores the element in the order they were added, while Set implementation doesn't provide such a guarantee. Similarly, since List provides Random access, you can access any element directly if you know the index, but Set doesn't provide such a facility. 

4 ways of Session management in Servlets, JSP, and Java Web Applications

Session tracking or Session management is an important feature of modern web applications which allows the server to remember its clients. By keeping a session for each user, the Server can serve the client better. It also helps in safety, security, and personalization and must for certain kinds of web applications like e-commerce sites like Amazon or e-bay which stores items selected by the user for purchase in a shopping cart, even after the user is logged out. 

String to Enum in Java - Example

Creating Enum from String
You can create Enum from String by using Enum.valueOf() method. valueOf() is a static method that is added on every Enum class during compile-time and it's implicitly available to all Enum along with values(), name(), and cardinal() methods. In order to create Enum from String, String must be the same as declared Enum otherwise, the code will throw "java.lang.IllegalArgumentException: No enum const class". the same technique can be used to convert String into Enum instance as well. 

9 difference between static vs non-static method in Java - Answer

One of the key differences between a static and a non-static method is that the static method belongs to a class while the non-static method belongs to the instance. This means you can call a static method without creating an instance of the class by just using the name of the class like the  Math.random() for creating random numbers in Java. Often utility methods that don't use the member variables of the class are declared static. On the other hand, you need an instance of the class to call a non-static method in Java. You cannot call it without creating an object because they are dependent upon the member variables which have different values for different instances.

How to Add Elements of two Arrays in Java - Example

One of the common programming exercises on various Java courses is the addition and multiplication of two arrays. How do you add two integer arrays in Java? Can you add two String arrays? how about other data types etc? These are some of the interesting questions because Java doesn't support operator overloading. You cannot use the plus operator to add two arrays in Java e.g. if you have two int arrays  a1 and a2, doing a3 = a1 + a2 will give a compile-time error. The only way to add two arrays in Java is to iterate over them and add individual elements and store them into a new array. 

How to read a text file into ArrayList in Java? Examples

Prior to Java 7, reading a text file into an ArrayList involves a lot of boilerplate coding, as you need to read the file line by line and insert each line into an ArrayList, but from Java 7 onward, you can use the utility method Files.readAllLines() to read all lines of a text file into a List. This method returns a List of String that contains all lines of files. Later you can convert this List to ArrayList, LinkedList, or whatever list you want to. Btw, this the fourth article in the series of reading a text file in Java. 

6 Difference between forward() and sendRedirect() in Servlet - Answer

Servlet in JEE platform provides two methods forward() and sendRedirect() to route an HTTP request to another Servlet for processing. Though both are used for forwarding HTTP requests for further processing there are many differences between the forward() and sendRedirect() method e.g. forward is performed internally by Servlet, but the redirection is a two-step process, where Servlet instructs the web browser (client) to go and fetch another URL, which is different from the original. That's why forward() is also known as a server-side redirect and sendRedirect() is known as the client-side redirect. 

java.lang.IllegalStateException: getOutputStream() has already been called for this response

This error comes when you call to include() or forward() method after calling the getOutputStream() from ServletResponse object and writing into it.  This error is similar to java.lang.IllegalStateException: getWriter() has already been called for this response error, which we have seen in the earlier article.

This is the exception:
org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:424)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
HelloServlet.doGet(HelloServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)

and here is the root cause :

3 ways to Copy a File From One Directory to Another in Java, Examples

Even though Java is considered one of the best feature-rich programming languages, until Java 7, It didn't have any method to copy a file from one directory to another directory. It did have the java.io.File class, which provides a method to check if a file exists or not and methods for several other file operations but it lacks support for copying files from one folder to another. It was easy to write your own routine to copy a file using FileInputStream or FileChannel, most developers prefer to use Apache Commons IO library; which is not a bad idea at all. 

How to read a text file as String in Java? Example

There was no easy way to read a text file as String in Java until JDK 7, which released NIO 2. This API now provides a couple of utility methods that you can use to read the entire file as String e.g. Files.readAllBytes() returns a byte array of the entire text file. You can convert that byte array to String to have a whole text file as String inside your Java program. If you need all lines of files as a List of String e.g. into an ArrayList, you can use Files.readAllLines() method. This returns a List of String, where each String represents a single line of the file. 

How to convert Enum to String in Java with Example

Enum to String Conversion Example in Java
There are two ways to convert an Enum to String in Java, first by using the name() method of Enum which is an implicit method and available to all Enum, and second by using toString() method. name() method of Enum returns the exact same String which is used to declare a particular Enum instance like in WeekDays Enum if we have MONDAY as one Enum instance then the name() will return String "MONDAY". This method of conversion from Enum to String is useful if the String representation of Enum is the same as its String name but if you have different String representation then you can use toString() method. 

How to Increase Heap Size of Java Program running in Eclipse [Example]

It is possible to increase the heap size allocated by the JVM by using command-line options Here we have 3 options

-Xms<size>        to set the initial Java heap size
-Xmx<size>        to set the maximum Java heap size
-Xss<size>          to set the java thread stack size

$ java -Xms1G -Xmx2G MainClass

In the above line, we have set the minimum heap size to 1GB and the maximum heap size to 2GB.

How to fix java.lang.IllegalStateException: getWriter() has already been called for this response [Solution]

This error comes when a Servlet calls the getOutputStream() method on the response object for writing something after calling the include() method. Suppose a Servlet calls the include() method to load the response of a JSP. Since JSP has already written the response on it hence again opening OutputStream on the response object is illegal, you get the java.lang.IllegalStateException: getWriter() has already been called for this response error. This error also comes when you try to include the response of another Servlet and then tries to write something on the output stream again. In short, your Servlet should never write anything on the response object after calling the include() method. 

Difference between jsp:include and jsp:forward action- Example

JSP provides standard actions to do things without using Java inside the scriptlet. Two of such standard actions, which help JSP to interact with other server resources e.g. another JSP, Servlet, or HTML files are, include and forward actions. The <jsp:forward> action enables you to forward an HTTP request to a static HTML file, a servlet, or another JSP. It has an attribute called page, which accepts the URL of another resource as shown below:
<jsp:forward page="URL" />