Monday, May 31, 2021

How to Convert a Stream to List, Set, and Map in Java [Examples]

Hello guys, if you are wondering how to convert a Java Stream to Java Collections like List, Set and Map then you have come to the right place. Earlier, I have shared free Java Courses for beginners and in this article, I am going to share examples to convert Stream to ArrayList, LinkedList, HashSet, TreeSet, LinkedHashSet, TreeMap, HashMap, and ConcurrentHashMap in Java. These are easy-to-follow examples and suitable for both beginners and experienced Java programmers.  In Java 8, Stream is one of the most important classes as it allows a lot of useful functional operations like filter, map, flatmap, etc on a collection of objects. Hence, going forward converting a Collection to Stream, performing operations, and then converting the result back to different Collection classes like List, Set, and Map will be a common task. 

Sunday, May 30, 2021

Top 5 Free Swift Programming Courses for Beginners in 2021- Best of Lot

Hello guys, how are you doing this lazy Saturday? You might be thinking, as a Java developer why I am suggesting you learn Swift. Still, the truth is that I am not suggesting you abandon Java and join Swift, I am suggesting you join Swift if you want to develop iOS applications. We all use Apple's products, and we love them; I have used iPod, iPhone, iPad, Apple Watch, and even MacBook, and every time I use their product, I just say wow, and Swift is no different from that. It's a programming language from Apple, so you will find all the features which make Apple product great.

Saturday, May 29, 2021

Top 5 Free Courses to learn Node.js in 2021 - Best of lot

Node JS has completely changed the way JavaScript is used for development. Earlier JavaScript was considered as a client-side language because it runs on a browser and mostly used for client-side validations, animations, and interaction. Node.js takes that to the next level by allowing JavaScript to run on a server-side, which means you can now write JavaScript applications that can execute without a browser. Node JS uses Google Chrome's execution engine and asynchronous processing to do this. All you need to is include a node.js script in your application, and you are ready to create server-side applications in JavaScript, which wasn't possible until a few years back.

Difference between private and final class, method, and variables in Java?

Hello guys, one of the common questions among Java beginners is what is the difference between a private and final keyword in Java? The confusion arises because they are very similar and used in a similar context. For example, you can make a class, a method, and variable final as well as private. Both put some kind of restriction like you cannot override a final method in Java and the private method is not even accessible outside the class, so obviously you cannot override it. The main difference between private and final keywords in Java is that private is primarily an access modifier, which controls the visibility of variables, methods, and classes in Java applications, while final is just a modifier that enforces additional constraints on the field, method, and class in Java.

Friday, May 28, 2021

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

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.

Thursday, May 27, 2021

Top 5 Free R Programming Courses for Beginners in 2021 - Best of Lot

More and more people are learning the R programming language to become a Data Scientist, 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.

Wednesday, May 26, 2021

RegularEnumSet vs JumboEnumSet in Java

Hello guys, the difference between RegularEnumSet and JumboEnumSet in Java was asked in a recent Java interview with one of my friends, unfortunately, he hasn't explored this topic well and couldn't answer this question precisely, but he made sure to learn about EnumSet after that. When he discussed this topic with me, I really liked it because, despite the usefulness of EnumSet and its fast implementation, not many developers know about it, despite being mentioned in Java's classic Effective Java. This makes me write this post, where we will mainly discuss a couple of differences between RegularEnumSet and JumboEnumSet in Java, but we will also touch base upon some of the important properties of EnumSet.

How to swap two Integers without using a temporary variable in Java?

One of the oldest trick questions from a programming interview is, How do you swap two integers without using a temp variable? This was first asked to me on a C/C++ interview and then several times on various Java interviews. The beauty of this question lies both in the trick to thinking about how you can swap two numbers without the third variable, but also problems associated with each approach. If a programmer can think about integer overflow and consider that in its solution then it creates a very good impression in the eye of interviewers.

Monday, May 24, 2021

Top 5 Free Courses to learn PHP and MySQL in 2021 - Best of lot

If you want to build web applications quickly like overnight or over the weekend, then PHP and MySQL are the right choices and because of this power, they are also the best language for freelancing and startups where quick turnaround time is required. PHP and MySQL are incredibly powerful open source technologies that allow programmers and web developers to create functional websites and apps that go way beyond basic HTML. PHP is specially designed to generate interactive and dynamic websites and is also known as the server-side scripting language, while MySQL is one of the leading relational databases along with Oracle and Microsoft SQL Server.

Sunday, May 23, 2021

Singleton in Java using Enum [Example]

Hello guys, the Singleton pattern in Java is used to create a Singleton class that is accessed by a single instance though out the Java program life cycle. Singleton is one of the old but very useful design patterns and used in several core Java libraries including Java Development Kit (JDK); java.lang.Runtime is an example of a Singleton pattern in Java. This class represents a single instance of Java environment running as JVM and provides several utility methods to query important details about runtime like a number of available processors, Java heap memory, etc.

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

Friday, May 21, 2021

2 Ways to solve FizzBuzz in Java? [Solution]

Hello guys, if you are learning to code or preparing for interviews and looking how to solve the FizzBuzz problem in Java then you have come to the right place. Earlier, I have shared 75 programming exercises and in this article, I will teach you how to solve the FizzBuzz problem in Java. FizzBuzz is one of the most frequently asked questions on programming interviews and used to filter candidates on Coding interviews who can't code. It looks extremely simple but it's tricky for those programmers or coders who struggle to structure their code or lack the ability to convert a simple algorithm into code. 

Thursday, May 20, 2021

3 Examples to reverse an Array in Java [Solution]

Hello guys, today we are going to see another common coding question from interviews - how do you reverse an array in Java? This is a popular array-based coding problem and often asked programmers during the first few rounds of interviews to check if they can code or not. Well, there are multiple ways to solve this problem and we will see three common ways to ever an array in Java. This method applies to all kinds of arrays like string array or integer array or even with arrays of objects because it's not focused on data types. The first way to reverse an array is by reversing it in a brute force way, without using any additional data structure or library method. 

Wednesday, May 19, 2021

3 Books and Courses to Learn RESTful Web Services using Spring and Java in 2021

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

How to calculate Sum of Numbers using Array in Java [Example]

Hello guys, if you are thinking about how to calculate the sum of all numbers in a given integer array then you have come to the right place. Earlier, I have shared 75 programming questions from the interview and in today's coding problem, you will learn how to write a program to calculate the sum of array elements in Java. As part of this coding problem, you need to write a method that will accept an integer array and it should return the total sum of all the elements. The array could contain both positive and negative numbers but only decimal numbers are allowed. 

Tuesday, May 18, 2021

How to Find Highest Repeating Word from a File in Java [Word Count Solution]

Hello guys, if you are looking for a Java program to print the word and their count from a given file then you have come to the right place. Earlier, I have shared 100+ Data Strucutre and Algorithms Problems from interviews and in this article, I will show you how to find worlds and their count from a given file in Java. How to find the word and their count from a text file is another frequently asked coding question from Java interviews. The logic to solve this problem is similar to what we have seen in how to find duplicate words in a String, where we iterate through string and store word and their count on a hash table and increment them whenever we encounter the same word. 

Monday, May 17, 2021

Top 5 Scala and Functional Programming Books & Online Courses in 2021 [Best of Lot]

Hello guys, if you are a Java developer who is interested in learning Scala or someone starting with Scala afresh and looking for some awesome Scala resources like books, courses, and tutorials then you have come to the right place. In the past, I have shared some free Scala courses to start with and today, I will share some of the best books to learn Scala and Functional Programming, particularly Java developers. While in this age of online courses, fewer and fewer people are using books to learn a new technology or skill but in my opinion, both books and courses have different purposes. I have taken many online courses and read even more books so I can tell that books are almost always more in-depth and provide comprehensive coverage than courses.

How to Print Floyd's Triangle in Java - Example Tutorial

Hello guys, In the last article, I have taught you how to print Pascal's triangle and in today's article, I'll teach you how to print Floyd's triangle in the Java program. Floyd's triangle is easier to print than Pascal's triangle because you don't need to take care of formatting the numbers as Floyd's triangle is a right-angle triangle. It is named after American computer scientist Robert Floyd, who has also contributed Floyd–Warshall algorithm, which efficiently finds all shortest paths in a graph, and Floyd's cycle-finding algorithm for detecting cycles in a sequence. 

Sunday, May 16, 2021

3 Ways to Find or Count Duplicates in Java Array [Solution]

Hello guys, if you are wondering how to find duplicates from a given array in Java then you have come to the right place. This is one of the most popular coding problems from interviews and there are multiple ways to solve this problem. In this article, I will show you three ways to solve this problem. First, you will learn how to solve the problem using brute force way and then you will see how you can optimize and simplify the solution by using additional memory and using an appropriate data structure like a HashSet or Hash table. In the real interview, you may need to solve this problem in some constraints like you cannot use additional memory or additional data structure that's where knowing multiple ways to find duplicate in Java array really help.

Saturday, May 15, 2021

Top 5 Free Azure Solution Architect Technologies (AZ -303/304, AZ-300/301) Courses to Crack Exam in 2021

Hello guys, if you are preparing for Azure Solution architect technologies certification with code AZ--303 and AZ-304 or its older version AZ-300 and AZ-301 and looking for free online courses to start your preparation then you have come to the right place. In the past, I have shared the best courses to pass Azure FundamentalsAzure Administrator, and Azure Architect certifications and today I am going to share free online courses to prepare for the AZ-303 exam. Since this exam is fairly new, released in June 2020, there are not many free AZ-303 and AZ-304 courses are available online but since the topics haven't changed drastically, you can still use the old AZ-300 and AZ-301 courses to start your preparation.

Difference between Soft Link vs Hard Links in Linux/UNIX?

Hello guys, if you are looking to find out the difference between a soft link and a hard link in Linux then you have come to the right place. Earlier, I have shared the free Linux courses for beginners and in this article, I am going to explain the soft links and hard links in UNIX operator systems like Linux. There are two types of links in the UNIX system, hard links and soft links, also known as symbolic links or symlinks. Though both points to some other source, there is a lot of difference between them. The most important difference is that a hard link is a direct pointer to the inode of the original file. If you compare the original file with the hard link there won't be any differences between them. 

Wednesday, May 12, 2021

How to Find 2 Largest Number from Integer Array in Java [Solution]

Hello guys, I have been sharing a lot of Programming interview questions and coding problems to learn programming better which is appreciated by you guys. In this post, I have come with other simple programming problems for Java beginners. I love to share short programming problems because they help in developing programming sense. Many people will argue against simple problems like prime numbers, palindrome, and factorial, but I really find them useful, especially for beginners. A beginner is far away to solve a complex data structure problem or even more complex problems like those that appear in TopCoder or other programming sites. Programmers learn gradually and they need the joy of doing something and seeing results much quicker than any other. Small success motivates them.

Tuesday, May 11, 2021

How to Check If Given String has Only Unique Characters in Java? [Solution]

Hello guys, if you are looking to solve the classic problem "checking if a String has all Unique characters" or not then you have come to the right place. Earlier, I have shown you how to reverse String in place, and in this article, I will show you how to check for unique and duplicate characters in String.  You need to write a program to determine if a given string has all unique characters or not. For example input= "Java" then your function should return false because all characters are not unique, and if the input is "Python" then your program should return true because all characters in Python are unique.

Monday, May 10, 2021

How to find largest and smallest number from integer array - Java Solution

Hello guys, if you have gone through any coding interview or have done some professional Software development then you know that a good understanding of array data structure is crucial for any software developer but it doesn't come for free, you need to spend time and effort. The best way to develop this understanding by solving coding problems and there are lots of programming exercises beginners can do. One of them is writing a program to find the smallest and largest number in an integer array. Java programmers are no different than others, so they can do this program in Java, not just to understand array but also different relational operators available in Java.  

Wednesday, May 5, 2021

How to check if a Number is Power of Two in Java? [Bitwise AND Example]

Hello guys, if you are thinking about how to check if a given number is a power of two without using an arithmetic operator like division then you have come to the right place. In Java, you can use bitwise operators like bitwise AND check if a given number if the power of two or if the given number is even or odd. In this Java Programming tutorial, you will learn how to check if the number is the Power of two using a bitwise operator. The main purpose of this program is to teach you how to use bit-wise operators like bitwise AND (&)  in Java. A number is said to be the power of two if all its prime factors are 2, but in the binary world, things work a little differently. 

Monday, May 3, 2021

How to reverse a String in place in Java - Example

One of the common Java coding interview questions is to write a program to reverse a String in place in Java, without using additional memory. You cannot use any library classes or methods like StringBuilder to solve this problem. This restriction is placed because StringBuilder and StringBuffer class define a reverse() method which can easily reverse the given String. Since the main objective of this question is to test the programming skill and coding logic of the candidate, there is no point in giving him the option to use the library method which can make this question trivial. Now, how do you solve this problem? If you are familiar with an array data structure then it would be easy for you. Since String is backed by a character array, you can use the same in-place algorithm we have used to reverse an array in place.

Sunday, May 2, 2021

Matrix Multiplication in Java using Scanner, Class, and Function [Example]

Hello guys, if you are looking for a matrix multiplication example in Java using the scanner for user input, and using class and object-oriented programming then you have come to the right place. In this Java tutorial, I will show you how to multiply matrix in Java using an array, scanner, and object-oriented programming. We will create a class to represent matrix and then define a multiplication method to multiply two matrics in Java. I first learned about matrix in class 12th and I first wrote the program to multiply two matrices on my first semester of engineering, so, when I thought about this program, It brings a lot of memories from the past. 

Saturday, May 1, 2021

2 Ways to Find Factorial of an Integer Number in Java [Recursion + Iteration Solution]

Hello guys, if you are looking for a Java program to calculate factorial with and without recursion then you have come to the right place. Factorial is a common programming exercise that is great to learn to code and how to program. When I teach Java to new people, I often start with coding problems like prime numbers, Fibonacci series, and factorial because they help you to develop a coding sense and teach you how to write a program initially. In order to calculate factorial, you just need to know the factorial concepts from Mathematics, and rest I will explain this simple Java programming tutorial.