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

Top 40 Core Java Interview Questions Answers from Telephonic Round [UPDATED]

Here is another post about preparing for Java Interviews, this time we will take a look at 40 core Java questions from the telephonic round of Java Programming interviews. Phone interviews are usually the first step to screen a candidate after selecting his resume. Since it's easy to call a candidate than to schedule a face-to-face interview, book rooms, and arrange for a meeting, a telephonic round of interviews is quite popular nowadays. There were days only one telephonic round of interviews was enough but nowadays, it's almost two and three rounds of phone interviews with different team members before you get a chance for face-to-face interviews. 

How to remove duplicate characters from String in Java? [Solved]

Hello all, how are you doing? It's been a long since I have shared a coding problem from the interview. The last one I discussed was about finding the Nth Fibonacci number, one of the popular dynamic programming problems. Never mind,  today, you are going to learn about another popular coding problem.  How do you remove duplicate or repeated characters from String in Java is one of the frequently asked string-based coding problems from Interviews. This problem is very similar to removing duplicate elements from an array which we have discussed in the past here after all String is a character array in Java. If you know how to solve that problem, you should be able to solve this one as well.

3 Ways to change Embedded Tomcat Server Port in Spring Boot Application - Example

If you know Spring Boot really simplifies the Java web development by embedding essential libraries as well as a tomcat server to run Java web applications. By default, this tomcat server listens on port 4588, and for any reason, if you want to change, then Spring boot provides several configuration options to achieve that. For example, I wanted tomcat to listen on port 8080 because port 80 is forwarded to 8080 in our Linux machine, and we wanted our clients to provide our client with a clean URL without a port.

How to find Kth Smallest Element in a Binary Search Tree? [Solved]

Hello guys, I have been sharing binary search tree-based coding interview questions for quite some time. In the last article, we looked at how to find the maximum sum level in a given binary tree, and in this article, we will find the kth smallest number in a given binary tree like the 5th smallest or 3rd smallest number. Before we find the kth smallest in a Binary search tree, We need to understand the binary search tree. A Binary tree is a data structure in which each node can have at most two children. That is, each node in the binary tree will have data, left child and right child. The first node of the tree is called the Root.

Difference between @SpringBootApplication vs @EnableAutoConfiguration annotations in Spring Boot? Example

Even though both @SpringBootApplication and @EnableAutoConfiguration can be used to enable the auto-configuration feature of Spring Boot, there is a subtle difference between them. The @SpringBootApplication does much more than what @EnableAutoConfiguration does. It's actually a combination of three annotations: @Configuration, which is used in Java-based configuration on Spring framework, @ComponentScan to enable component scanning of components you write like @Controller classes, and @EnableAutoConfgiuration itself, which is used to allow for auto-configuration in Spring Boot application.

How to check if a Key Object Exists in HashMap Java? containsKey() Example Tutorial

Hello guys, you might know that one of the common programming tasks while using HashMap in Java is to check if a given key exists in the map or not. This is supposed to be easy, right? Yes, it is easy if you know your API well, all you need to is call the containsKey() method, it returns true if the given key exists in HashMap, otherwise false; but I have seen many programmers write code like below which is not correct, which inspired me to write this blog post.

if(map.get(key) !=  null){
    System.out.println("key exits in Map");
}

This code is fragile, it will not work if you have added null values into HashMap because HashMap does allow null values.

How to find the maximum sum level in a given binary tree in Java? Example Tutorial

Hello guys, if you are preparing for a coding interview and wondering how to find the maximum sum level in a given binary tree in Java then you have come to the right place. I have been sharing binary tree coding problems for the last few months and in the past, we have seen questions like finding kth smallest element and finding the lowest common ancestor of a binary tree in Java in this article, you will learn how to find the maximum sum level in a given binary tree of integers or numbers. But, before finding the maximum sum level of a binary tree in java, we need to have a good understanding of a binary search tree. Both theoretical knowledge and how to implement binary search tree in Java is important to solve tree-based coding problems

Decorator Design Pattern Example in Java [Tutorial]

The Decorator design pattern is one of the famous Gang of Four (GOF) structural design patterns, which provides a dynamic way of extending an object's functionality. It's different than the traditional way of adding new functionality into an object using Inheritance, instead, it uses Composition which makes it flexible and allows the addition of new functionalities at the run time, as opposite to Inheritance, which adds new functionality at compile time. Because of this flexibility, Decorator is one of the darling patterns for many Java developers. 

Difference between notify and notifyAll in Java? [Answered]

wait, notify, and notifyAll methods are used for inter-thread communication in Java. wait() allows a thread to check for a condition, and wait if the condition doesn't meet, while notifying() and notifyAll() method informs waiting for a thread for rechecking condition, after changing the state of a shared variable. One good example of how to wait and notify method works is the Producer consumer problem, where one thread produces and waits if the bucket is full; and another thread consumes and waits if the bucket is empty. 

How to create a dynamic list in React? Example Tutorial

1. Introduction

Working with lists is common in React web development. Creating a static list is very easy but making it dynamic can be tough. Dynamic lists can generally be manipulated in one way or another. For example, a new item can be added to a list by entering a value in an input field or an item can be removed when it is clicked. 


In this tutorial, we will learn how to create a dynamic list in which a new item can be added through an input field. Moreover, we will learn how to delete an item when clicked.

How to Solve Producer Consumer Problem in Java using BlockingQueue [Example]

The Producer-Consumer problem is one of the classic multi-threading problems in computer science and the multi-threading world. It's tricky because it involves inter-thread communication, but it's important because most of the multi-threading problems fit into this category. Because of its importance, it's also known as Producer Consumer design patterns. There are many ways to solve the producer-consumer problem in Java, like you can solve this by using the wait() and notify() method, as discussed here, or you can use the Semaphore to solve this problem. 

10 Programming questions and exercises for Java Programmers

If you have just started learning the basics of Java programming language or are familiar with programming in either C or C++, then these Java programming questions and exercises are for you. It doesn't focus on a particular part of Java, but these coding exercises will switch you into programming mode. These are also great ways to master basic programming construct like if-else, loops like for and while break and continue with loop,   Java operators e.g., arithmetic and logical operator, recursion, methods, or functions, and standard Java API. You may also find these Java programming questions in most Java courses taught in schools, colleges, and various Java training courses.

How to Find the Largest and Smallest of Three Numbers in Java? [Solved]

Hey Java programmers, I have been sharing coding problems from interviews for quite some time and today I am going to share with you another interesting coding problem for beginners, how to find the largest and smallest of three numbers. If you are learning how to program or looking to improve your problem-solving and coding skills then these kinds of small problems are good to start with. They not only provide you an opportunity to think about how to solve a problem using basic programming constructs like conditionals (if, else, if-else, switch), loops (for, while, do-while), operators like arithmetic, the bitwise and logical operators as well as teach you how to write functions, class and create a program which you can run.

Difference between wait() and join() methods in Java [Answered]

Though both wait() and join() methods are used to pause the current thread and have a lot of similarities they have different purposes. One of the most obvious differences between the wait() and join() methods is that the former is declared in java.lang.Object class while join() is declared in java.lang.Thread class. This means that wait() is related to the monitor lock which is held by each instance of an object and the join method is related to the thread itself. The wait() method is used in conjunction with notify() and notifyAll() method for inter-thread communication, but join() is used in Java multi-threading to wait until one thread finishes its execution.

Top 12 Java Thread, Concurrency, and Multithreading Interview Questions with Answers

Java concurrency and thread interview questions answers
Multithreading is an important feature of the Java programming language, which means threads are also an important part of any Java interview. It's true and in fact, at beginners and freshers, level Thread interview questions in Java are one of the most difficult to answer. One reason for interview questions related to multithreading and concurrency being difficult is confusion around how multiple threads work together and the second is threads are genuinely a complicated topic to understand and use correctly.

5 Best Django Python Courses for Beginners to Learn Online in 2022 [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.

Difference between CountDownLatch vs CyclicBarrier in Java Multithreading

Difference between CountDownLatch and CyclicBarrier in Java
Both CyclicBarrier and CountDownLatch are used to implement a scenario where one Thread waits for one or more Thread to complete their job before starting processing but there is one difference between CountDownLatch and CyclicBarrier in Java which separates them apart and that is, you can not reuse the same CountDownLatch instance once count reaches to zero and latch is open, on the other hand, CyclicBarrier can be reused by resetting Barrier, Once the barrier is broken.

Top 3 Niche Programming Languages You can Learn in 2022

 Hello guys, if you are looking for programming languages to gain an edge over the competition then you have come to the right place. In the past, I have shared the best programming language for beginners, the best programming langauge for Data Science, the best programing langauge for web development, Cyber Security, App Development, and game development in this article, I am going to share 3 unique programming langauge which you can learn to distinguish your resume from others. I have chosen a combination of dynamic programming langauge, functional programming langauge, and something which is not very common and makes you a niche developer. 

Producer Consumer Problem with Wait and Notify - Thread Example Tutorial

The Producer-Consumer Problem is a classical concurrency problem and in fact, it is one of the most powerful concurrency design patterns which is used in most multithreaded Java applications. In the last article, I have shown you how to solve the Producer-Consumer problem in Java using blocking Queue but one of my readers emailed me and requested a code example and explanation of solving the Producer-Consumer problem in Java with the wait and notify method as well Since it's often asked as one of the top coding questions in Java. In this Java tutorial, I have put the code example of the wait notify version of the earlier producer-consumer concurrency design pattern. 

Top 10 Java Interview Questions for 2 to 3 years experience - Answered

Java Interview Questions 2 to 4 years of experience
If you are a Java programmer with 2 to 3 years experience of working in Java and looking for a job change then it's better to know what is expected from 2 to 3 years experienced Java programmer in a typical core Java or J2EE interview. Since 2 to 3 years is not a vast experience and you still fall under beginner to the intermediate category, it's not expected from you to have done profiling, Garbage collection tuning, designing complex Java applications, or even creating concurrent Java design patterns

Java 8 - Map and Reduce Example Tutorial

Hello folks, the map-reduce concept is one of the powerful concepts in computer programming, particularly on functional programming which utilizes the power of distributed and parallel processing to solve a big and heavy problem in a quick time. From Java 8 onwards, Java also got this powerful feature from the functional programming world. Many of the services provided on the internet like Google Search are based on the concept of the map and reduce. In map-reduce, a job is usually split from the input data-set into independent chunks which are processed by the map tasks in a completely parallel manner. The framework then sorts the outputs of the map operation, which are then supplied to the reduce tasks.

How to convert Date to LocalDateTime in Java 8 - Example Tutorial

The LocalDateTime class has been introduced in Java 8 to represent both date and time values. It's local, so date and time are always in your local time zone. Since the java.util.Date has been widely used everywhere in many Java applications, you will often find yourself converting java.util.Date to LocalDate, LocalTime, and LocalDateTime classes of the java.time package. Earlier I have shown you how to convert Date to LocalDate and today, I am going to teach you how to convert Date to LocalDateTime in Java 8. The approach is the same. Since the equivalent class of java.util.Date in new Date and Time API in java.time.Instant, we first convert Date to Instance and then create LocalDateTime instance from that Instant using System's default timezone.

Top 10 Tricky Java interview questions and Answers

What is a tricky question? Well, tricky Java interview questions are those questions that have some surprise element on them. If you try to answer a tricky question with common sense, you will most likely fail because they require some specific knowledge. Most of the tricky Java questions come from confusing concepts like method overloading and overriding, Multi-threading which is really tricky to master character encoding, checked vs unchecked exceptions, and subtle Java programming details like Integer overflow. The most important thing to answer a tricky Java question is attitude and analytical thinking, which helps even if you don't know the answer. 

Right way to check if String is empty in Java with Example

What do most of us Java Programmers do while using String in Java? Check whether String is null or empty right? I am sure you know a couple of ways to test whether String is empty or not, but do you know the right way to do it? When we talk about Strings in Java, we can imagine them as arrays of characters, and they are, but in Java, they also object. An empty Java String is considered as the not null String that contains zero characters, meaning its length is 0. However, a Java String that might only contain the white-space character is not considered empty, it is considered to contain one character and its length is equal to 1. 

Top 5 Free & Paid Spring Certification Courses and Practice Tests

Many Java developers don't know that, similar to Oracle's Java certification, there is also a Spring certification program, which certifies yourself for your Spring framework skill. There are three Spring certifications currently available, the Spring Professional certification exam, also known as the Vmware Certified Spring Professional exam (VMware EDU-1202) which certifies on your general knowledge about Spring framework, Spring MVC skill, Spring Boot, Spring Data JPA, Testing with Spring and Spring Boot, and other advanced Spring skills. Earlier, SpringSource provides these certifications, but now they are provided by Vmware, the company behind the Spring framework.

What is objects in JavaScript? Example Tutorial

JavaScript is a dynamically typed programming language. In JavaScript, it is not required to define the data type of a variable but that does not mean JavaScript does not have data types. Data types in JavaScript are divided into two categories - primitive and non-primitive.


Primitive data types such as numbers and strings can hold only a single value. But non-primitive types can hold more than one value. Objects in JavaScript are non-primitive. 


If you have ever done programming, you may be familiar with the concept of objects because objects are one of the most important parts of programming. The reason is simple. Objects can hold multiple values. In this article, we will discuss objects in JavaScript. 

How to Pass Spring Professional 5.0 Certification (VMware EDU-1202) in 2022 [UPDATED]

Hello guys, if one of your new year goals is to pass the Spring Developer Certification this year and wondering where to start then you have come to the right place. In this, article, I'll tell you how to prepare for Spring Professional v 5.0 certification (VMware EDU-1202)  and useful resources to pass the exam on the first attempt. If you have been self-preparing for Spring Professional 5.0 exam, then you might have struggled with which topics to prepare and which topics to leave out. I often receive questions like does Spring Boot is part of Core Spring certification? Will there be any questions from Spring Security and Spring Data? Does Spring Cloud also part of this exam or not? Unfortunately, there is no detailed, semester syllabus for Vmware's Core Spring certification (VMware EDU-1202) 

5 Best books to Learn JDBC for Java Programmers

The JDBC (Java Database connectivity) is one of the vital API in the Java programming language which allows a Java program to connect to any database, like Oracle, Microsoft SQL Server, MySQL, PostgreSQL, SQL Lite, Sybase or any other relational database. It's an essential API to learn and master for both core Java and Java EE professionals, given the ubiquitous nature of Databases in real-world applications. Despite its importance, many Java developer lacks essential JDBC skills, like they are not familiar with Connection, Statement, connection pool, calling stored procedures, and executing a transaction in JDBC.

Top 10 RESTful Web Service Interview Questions for Java Developers

REST is an architectural style of developing web services that have become immensely popular in the last couple of years and consequently gained a lot of importance in core Java and Java EE interviews. If you are a Java web developer, then you are most likely to see a couple of questions from web services every time you go for a Java web developer interview. One of the most frequent ones is the difference between REST and SOAP web services, which I have recently answered there, but there are a lot many other good questions I have collected from friends and my readers, which I have not yet published. In this article, I am sharing those questions, mainly based on REST-style web services for your practice and preparation.

Top 5 Resources to become a Certified Spring Developer Professional in 2022

Ever since Pivotal has announced that Spring training is not mandatory for becoming a Certified Spring developer (now VMware EDU-1202), more and more experienced Java programmers who have been using Spring for years are preparing for this certification exam. This is obvious because the expensive Spring training, which cost around 32000 USD in the USA and most Western nations and about 50,000 INR in India, was the biggest hurdle in getting Spring certified and becoming a certified Spring professional. 

Top 5 Free Courses to crack AWS Solution Architect Certification in 2022 - Best of Lot

A professional certificate speaks louder than a typical CV. Not all certificate holds worth, but some professional certificate does! AWS (Amazon web services) Solution architect associate is one of the most prestigious certifications. There is a lot of demand for AWS certified Solution architects as many companies seek experts who can manage their AWS assets. Amazon also ensures that their partners have certified AWS professionals which further fuels the demand for AWS certification. Given the future of Software development is on the cloud and sooner or later most of the companies will move to the different cloud platforms, particularly AWS gave it's the most popular public cloud, investing your time on acquiring AWS certification can really boost your profile in 2022. 

10 Spring Framework Annotations Java Developer should learn - Example Tutorial

Hello guys, if you are learning the Spring framework and want to know what are essential Spring annotations you should know then you have come to the right place. Earlier, I have shared the free Core Spring and Spring Boot courses and Spring certification resources for Java developers, and in this article, you will find some of the most common annotations in this article, which is a must for a Java developer to work with Spring. You will also learn what does annotation really does and why should you learn them. There is no doubt that the Spring framework is one of the most popular Java frameworks, and it has made the life of Java developers easy by providing some excellent features in the last 15 years. 

Top 5 New Features Java Programmers should learn in 2022

Hello Java programmers, If you are wondering which new Java feature you should learn in 2022 then you have come to the right place. Earlier I have shared Java Developer RoadMap and essential Java Development framework and in this article, I am going to share the top 5 new Java features every Java developer should learn in 2022. This includes features like Record which can make creating value classes easier as well as Text Block, var, and many other features to improve your productivity. Java Programming language is changing rapidly. Now there is a new release every six months and it's hard to keep up-to-speed with new Java features. 

Top 10 Frameworks & Libraries Programmers can Learn in 2022 [UPDATED]

Hello Guys, we are in the first week of 2022 now, and many of you might have already made your goals about what to learn in 2022, but if you haven't, then you have come to the right place. In this article, I share some of the best frameworks and libraries for web development, mobile app development, and big data, which an application developer can learn in 2022. The New Year will be all about Mobile App Development, Blockchain, Cloud Computing. Machine learning, and next-generation web with a greater focus on big data technologies like Hadoop and Spark.

10 Tools Java Developers Should Learn in 2022 - (UPDATED)

Hello folks, we are in the first week of 2022, and many programmers have already started making a good process to their goals for 2022, which is very good, but if you are someone, who is still not sure what to learn in 2022, then you have come to the right place. In the past, I have shared 10 things Java developers to learn in 20221, and last week, I published the top 5 Java Frameworks to learn, but there is one topic that kept coming from my readers.  The question which I have received this week a couple of times from my fellow Java developers and readers is which tools Java programmers should learn in 2022? Or what are some excellent Java tools used in application development? And finally, what should I learn in 2022?