Saturday, January 28, 2023

[Solved] How to check if two String are Anagram in Java? Example

Hello guys, if you are preparing for Coding interviews then you already know that String is one of the most popular topics. You will be bound to get some string-based coding problems on interviews. If not, you have come to the right place becuase we'll look at one of the most popular String programming interview questions today,  how to check if two given strings are Anagram of each other? Two String is said to be an anagram of each other, if they contain exactly the same characters but in a different order. For example "ARMY" and "MARY" are an anagram of each other because they contain the exact same characters 'A', 'R', 'M' and  'Y'.

How to create a String or int Array in Java? Example Tutorial

There are several ways to create an array in Java, for example, you can declare the array without initializing it, or you can create and initialize the array in the same line. If you want to make an array with values, then you need to first decide which type of array you want to create? e.g., do you want a String array, which can contain String objects like "abc," "def," or do you want to create an int array that contains int values like 10, 20, etc. In Java, you can create an array of any type, including primitives like byte, int, long, and objects like String, Integer, and other user-defined objects. Let's some code to make a new array in Java.

Friday, January 27, 2023

How to use Map.compute(), computeIfPresent() and ComputeIfAbsent in Java? HashMap and ConcurrentHashMap Example

The JDK 8 has added several useful methods in existing interfaces e.g. java.util.Map, java.util.Collection, and java.util.concurrent.ConcurrentMap. Thanks to default methods, the much-needed evolution of existing interfaces becomes possible. Out of many useful methods, one method which stands out to me is the compute() method, which allows you to update a value in ConcurrentHashMap atomically. As per Java documentation, The compute() function tries to compute a mapping for the specified key and its current mapped value (or null if there is no current mapping). The entire function is performed atomically.

How to use LinkedList in Java? Singly LinkedList and Doubly LinkedList Example Tutorial

Hello friends, we meet again on our journey to Java. I hope you guys are enjoying Java and are trying hands-on too. Today we are gonna discuss a very easy topic (yeah, I mean it :p). But, do not get carried away just by "easy", this is the hottest topic asked in various interviews, exams, and development purposes too. So, what's the wait? Let's start!  As usual, let's start with a scenario. Let's say you want a data structure that stores data in a sequential manner, like an array. But, you don't know the size yet while initializing the data structure. Arrays don't support that, they need a size beforehand. So, what should we do? Do not worry, as Java is here to help us again. Let's explore it then!

How to get First and Last Element of LinkedList in Java [Example]

Hello guys, if you are wondering how to get the first and last element from Java LinkedList then you have come to the right place. Earlier, I have shared the best Data structure and algorithms courses and in today's post, I will teach you how to get the first and last element of a linked list in Java. This is one of the common coding problems but we will see it from different angles. In Java, you don't need to write and create your own LinkedList, there is a built-in class called java.util.LinkedIn and you can use that class whenever you need a linked list data structure. 

Monday, January 23, 2023

Top 20 Ansible Interview Questions Answers for DevOps and Senior Developers

Hello guys, if you are preparing for DevOps or senior developer interview then you must pay attention to modern Software development and deployment tools like Docker, Kubernetes, Ansible, Chef and Salt, Puppet etc. Gone are the days where you can crack any Java Developer interview by just answer few core Java questions about HashMap and ConcurrentHashMap, nowadays a lot is expected from Java developers. There are coding round where you need to solve coding problems and then there are multiple rounds of phone and video interviews where you are asked all of kind questions about Java, Spring Boot, as well as essential tools like JUnit, Mockito, Docker, Kubernetes, Ansible etc. While focus could be different, depending upon your role, like for DevOps knowledge of Ansible is very much required for Developer only basic knowledge is good enough. 

Top 20 UI and UX Design Interview Questions and Answers

Hello folks, if you are a fresher who want to start your career in UI and UX design or a UI or UX Designer and preparing for your next job and looking for popular UI/UX  interview questions for preparation then you have come to the right place. Earlier, I have shared HTML Interview Question, CSS Interview Questions, web development questions, and JavaScript Interview Questions and in this article, I am going to share common UI and UX interview questions with answers. If you have worked in UI and UX design for quite sometime then you may know the answers of these questions but if you are new then you may need to go through these best UI and UX design courses to refresh you knowledge about essential UI and UX design concepts. 

Top 20 Unity Interview Questions and Answers for Game Developers

Hello guys, if you are preparing for Game Developer interviews where Unity or Unity 3D is listed as main skill then you must prepare Unity Interview Questions. If you already looking for Game Developer Interview questions and Unity questions for interviews then you have come to the right place. Earlier I have shared 20 Unreal Engine Interview Questions and in this article, I am going to share 20 Unity 3D Interview Questions with answers. If you have worked in Unity 3D then you can easily answer these questions but if you struggle to answer them then I also suggest you to checkout these Unity online courses to refresh your knowledge about Unity and the benefits it offer. Interviews are often difficult to crack because of vast variety of questions but knowing essential Unity concepts and best practices always helps.

Top 20 Unreal Engine Interview Question and Answers for Game Developers

Have you been having sleepless nights just because of the Unreal Engine interview that is ahead of you? Being in this situation is unavoidable especially after you have experienced problems during your previous interviews or you totally do not know what is required of you when it comes to Unreal Engine interview. Time for being in such a situation is now a thing of the past because right in this article you are going to know the kind of questions that are usually asked in this kind of interview and this will open up your eyes and you will be more than prepared when that day comes.  In this article, I am going to share 20 common Unreal Engine Interview questions for game developers to revise key concepts and get ready for interviews. If you have used Unreal Engine before then you can easily answer these questions but if you struggle then I suggest you to join one of these best Unreal Engine online courses to learn and revise key concepts in quick time.

Top 21 Chef Interview Questions and Answers for DevOps Engineers

Hello guys, if you are preparing for DevOps or SysOps interviews where Chef skills are required then you should prepare about common Chef Interview questions. If you already know this and looking for popular Chef Questions then you have come to the right place. Earlier, I have shared Interview questions on essential DevOps Tools like Docker Questions, Kubernetes Questions, Ansible Questions and in general DevOps questions and in this article, I am going to share common Chef interview questions and their answers. If you have used Chef in your project then most likely you will know the answers of all these questions but if you struggle to answer them then you can always checkout these Chef online courses to refresh your knowledge. 

Top 20 Shell Scripting Interview Questions and Answers

Have you struggle with Shell Scripting interview questions before? Have you been having problems in finding out the kind of questions asked in a Shell Scripting interview? If you have experienced this then it is high time that you find a solution. You cannot lose that dream job anymore and yet you can find with ease all you require to pass your interview. If that interview is a few days away, worry no more because you will get before that panel fully prepared and ready for the day by going through these common shell scripting questions. 

Friday, January 20, 2023

Top 30 Spring Core, Spring MVC and Spring Security Interview Questions Answers

Spring Interview Question is one of the first things Java programmers should prepare before appearing on any Java or Spring interview. With the immense popularity of Spring frameworks like Spring MVC and Spring Boot in the Java world, the focus on Spring skills on interviews increases daily. For those who don't know, the Spring framework is one of the most famous structures for Java applications, which aims to simplify Java development. It revolutionized the Java development when it initially came with concepts of  Dependency Injection and Inversion of Control, which made writing a testable and maintainable Java application

Difference between Thread.yield and Thread.sleep in Java? Answer

Sleep vs yield in Java
Sleep and yield are two methods that are used to get CPU back from Thread to Thread Scheduler in java but they are completely different than each other. The major difference between Sleep vs yield is that sleep is more reliable than yield and it's advised to use sleep(1) instead of yield to relinquish CPU in multi-threaded Java applications to give an opportunity to other threads to execute. In this Java tutorial, we will what are the differences between yield and sleep in Java. But before seeing the difference between sleep and Yield let's see some similarities between yield and sleep in Java

Thursday, January 19, 2023

Top 10 Projects You can Build to Learn Spring Boot in 2024

Hello guys, I have always said that there is no better way to learn anything then actually doing it and its 100% true for Spring Boot, one of the popular Framework for Java application Development. In my 20 years of experience, I have found that the best way to learn Java and Spring Boot is building projects. When you build project, common task surface them like creating a List or sorting a List and then you research and learn. Those learning stuck and make you better developer. Building project also have many advantage like it allows you to use a lot of technologies like Git, IntelliJIDEA, Hibernate, APIs etc together to build something which you can showcase to your potential employer. 

Sunday, January 15, 2023

[Solved] java.lang.ClassNotFoundException: org.Springframework.Web.Context.ContextLoaderListener in Java and Spring

Problem : You are getting java.lang.ClassNotFoundException : org.Springframework.Web.
Context.ContextLoaderListener in your Spring-based Java Web application.
Cause: This error comes when you are using the Spring MVC framework in your Java Web application and configured org.springframework.web.context.ContextLoaderListener as a listener in your deployment descriptor also known as web.xml, but the JAR which contains this class is not available in the web application's CLASSPATH.

How to fix org.springframework.beans.factory.BeanCreationException: Error creating bean with name X [Java Spring]

If you are using the Spring framework in your Java application and getting this error during startup it means Spring is not able to initialize the bean X and add it into its application context, Why? There could be multiple reasons like a typo on the spring bean name. Let's take a closer look at the stack trace to find out the real reason:

BeanInstantiationException: Could not instantiate bean class [X]: No default constructor found; nested exception is java.lang.NoSuchMethodException: X.()

Here X is the class, which is declared as Spring bean. The error clearly says that the default constructor is not present in class X.

Difference between Serializable vs Externalizable in Java - Interview Question

What is the difference between Serializable and Externalizable in Java is famous core Java interview questions and for some of them its one of those difficult Java question, which no one wants to see in Java interview. I was in that category until I read Effective Java and explored How Serialization works in Java and find out more about the Serialization process. What makes Serialization questions tricky is, Serialization as a persistence mechanism is not very popular. Many programmers prefer databases, memory-mapped files, or simple text files over Serialization. But Serialization has a distinguished advantage over these mechanisms.

What is the use of DispatcherServlet in Spring MVC? Interview Question Example

Hello guys, In today's article we are going to discuss one interesting and the important Spring MVC concept, which is also a popular Spring Interview question. How DispatcherServlet works internally in Spring MVC or What is the role of DispatcherServlet in Spring MVC are some of the frequently asked Spring MVC Interview Questions. You might have seen them already during your previous Java web development interviews but if you have not, it's a good question to know. In this article, I'll answer these questions by explaining What is DispatcherServlet and its importance in Spring MVC. The DispatcherServlet is one of the important components of the Spring MVC web framework and acts as a Front Controller.

Thursday, January 12, 2023

What is @Bean Annotation in Spring Framework? Example Tutorial

Hello Java programmers, if you are wondering what is @Bean annotation in Spring Framework, what is the purpose, and how to use it then you have come to the right place. Earlier, I have shared the best free Spring core and spring MVC courses and In this tutorial, you will learn the most frequently used Spring annotations @Bean, which are used to define different types of beans. Beans are the fundamentals of Spring framework, they represent the POJO class which is created and managed by Spring Framework. Whole Spring framework is about beans and their relationships. 

Top 53 Java Programs for Coding and Programming Interviews

Hello guys, if you are learning to code and programming, or preparing for a programming job interview and looking for some practice material then you have come to the right place. Earlier, I have shared the best string, array, linked list, and binary tree coding problems and In this article, I am going to share some of the most common Java coding and programming problems for beginners. These are the problems, I have solved myself to learn to program and develop a coding sense and these are the ones that keep coming on Java coding interviews. By going through these coding problems you will not only learn Java but also prepare yourself for Java interviews. 

How to Find/Print Leaf nodes in a Binary Tree in Java without Recursion - Example

In the last article, you have learned how to print all leaf nodes of a binary tree in Java by using Recursion, a useful technique to solve binary tree problems and in this article, we'll answer the same question without using Recursion. Why should we do this? Well, it's a typical pattern on a programming job interview to solve the same problem using both Recursion and Iteration. Since some questions are easy to solve using recursion like linked list problems, binary tree-based problems, tower of Hanoi, or Fibonacci series but their non-recursive solution is comparatively tricky, the interviewer tests candidates against this shift in the algorithm.

How to delete multiple elements from a LinkedList in Java? SubList() Example

Hello guys, if you are looking for an easy way to remove a sub set of elements from a LinkedList in Java then you have come to the right place. In the past, I have shown you how to sort a LinkedList in Java and how to create your own linked list implementation in Java and in this article, I am going to introduce you with an interesting method which can be used to delete a portion of LinkedList in Java in shot. Yes, there is a method exists  but not many Java developer knows about it. The method is called subList() and you can use this method with clear method in Java to delete a portion of linked list in one shot.

What is TreeMap in Java? HashMap vs TreeMap Example Tutorial

Hello guys, I hope you all are doing well and having lots of fun reading and learning Java Collections together. Today we are here a meet again on our journey of Java. I hope you all have seatbelts buckled up as today it's gonna be an adventurous ride while learning something that is most used in many production applications, coding, and whatnot. Today's topic, TreeMap in Java is very important because it holds a very significant feature Java development kit provides. This is also one class which many Java developer doesn't pay attention but it is really used for many use cases. Most Java developer just keep their attention to ArrayList, HashSet, and HashMap and thus missing out on many cool Java collection classes like TreeMap, WeakHashMap, and LinkedHashMap which saw earlier.

Wednesday, January 11, 2023

How ThreadLocal variables works in Java? Explained

Hello guys, ThreadLocal variable is an interesting concept and class from Java API. Not many developer knows about it and very few know how to use it correctly. A couple of years ago it was also a popular Java interview questions for experienced developer but over the years, it lost the popularity as more and more people are now asking about Phaser, CompletableFuture, ForkJoinPool, and other newly added concurrency utilities. ThreadLocal variables, as name suggests is local to thread, which means every thread has there own copy. This means they don't need to look at the main memory when they want to use that variable and best thing is that the variable is not even shared between threads so no locking or synchronization is needed. 

Monday, January 9, 2023

Difference between JIT and JVM in Java? Answered

The main difference between JIT and JVM is that JIT is part of JVM itself and its main function is to improve the performance of JVM by directly compiling some hot code (code that executes above a certain threshold) into native instruction. JIT stands for Just In time compilation and JVM stands for Java Virtual Machine. JVM is a virtual machine used in Java programming platforms to execute or run Java programs. The main advantage of JVM is that JVM  makes Java platform-independent by executing bytecodes. Java source code is compiled into class files, which contain bytecode.

Sunday, January 8, 2023

Top 10 Programming Languages to Learn in 2024 [UPDATED]

Hello guys, we're just one week away from 2024. This is when most of us start making our goals like physical goals, educational goals, and financial goals. As a programmer, one of our goals is to learn new technologies and programming languages, but which languages should you learn? Since acquiring a programming language requires both time and patience, you should learn a language worth the effort; I mean., it can reward you with a better job and career growth. In this article, I will share with you the top 10 programming languages you can learn in 2024 to get a job in your favorite companies like Google, Microsoft, and Facebook.

Wednesday, January 4, 2023

Top 11 JavaScript Frameworks and Libraries to Learn in 2024 - Best of Lot

There is no doubt that JavaScript is now the #1 programming language in the world and also the king of web development. If you want to become a web developer who can quickly create websites like you see on the internet, then a good knowledge of JavaScript and various, popular JavaScript web development frameworks is essential for you. These frameworks have completely changed the way people developed web applications a decade ago. After node.js, it's even possible to create a complete web application from front to back using just one programming language, JavaScript. That's why it has become the preferred programming language of all Full-stack Web Developers.

Monday, January 2, 2023

Top 10 Google Cloud Certifications You can Aim in 2024 - Best of Lot

Hello guys, If you are aiming for Cloud Certifications in 2024 then Google Cloud Platform is one of the most in-demand platforms to go for. It's backed by Google and there is a huge demand for people who know Google Cloud Platform or have some experience in using Google Cloud Platform for DevOps, Machine Learning, and Big Data. Getting certified is a good way to learn both essential skills and get recognition and that's why I am sharing the 10 best Google Cloud computing certifications you can aim for in 2024.  

Sunday, January 1, 2023

10 Projects You can Build to Learn TypeScript in 2024 - Best of Lot

Hello guys, if you want to learn TypeScript then there is no better way to learn then building projects. In my 20 years of experience in Software development, this is the most valuable lesson I have learned. Its Ok to read books and watch online courses but until you build something those knowledge will go in vain. You will forget most of them within few weeks. That's why its important to build project and keep building them. If you are looking for interesting TypeScript project ideas then you have come to the right place. Earlier, I have shared best TypeScript courses and best JavaScript courses and in this article, I am going to share 10 projects you can build to learn TypeScript in 2024. I have carefully chose these projects so that both beginner and intermediate TypeScript developer can benefit.