Preparing for Java Interview?

My books Grokking the Java Interview and Grokking the Spring Boot Interview can help

Download PDF

Monday, October 30, 2023

Why Java and Spring Developers Should Learn RESTful Web Services and Microservices

More and More companies are adopting  Microservices architecture e.g. Uber and Netflix already uses it and many startups I know is choosing REST and MicroService as the standard way to build and provide their services. This is fueling the demand for programmers who can develop robust and scalable Microservices and RESTful Web Services. Since Java is one of the most popular language for developing backend, it is also benefiting from this trend. The demand for Java developers who knows Spring framework and understand how to build RESTful web services is huge and that's why it has become a key skill in Java application development job market. 

Monday, October 23, 2023

15 Example of print() and println() methods in Java

Hello guys, if you have learned Java in early 2000 then there is  good chance that you must have written your first Java code using System.out.println(). For a long time, I have no idea what that mean but I alway use it to print messages on console. When I started working in Java and preparing for Java certification then I come to know that System is a class and out is an object of PrintStream which has println() method. That was a revelation for me. I also found that Java provides a powerful set of I/O classes for handling various input and output operations. Among these, the PrintStream class stands out as a versatile tool for writing formatted text to output streams. The print()printf() and println() methods within the PrintStream class, as well as System.out.println(), are particularly useful for printing different types of data to the console or other output destinations.

Thursday, October 19, 2023

Coursera Review - Is the Meta Frontend and Backend Developer Certificates Worth It in 2024?

Hello guys, if you want to become a frontend or backend developer in 2024 and looking for a well structured, reputed, and completely online program then Meta's Frontend and Backend developer certificates on Coursera are great place to start with. The Certifications will come from Meta, parent company of Facebook (similar to how the Certificates come from Google in the Google Professional Certificates) and they are taught by expert Software engineers of Meta. This means you will not only learn the latest tech skills which are highly looked after by employers but also you will get a chance to learn from best people in the world. But, what separate this professional certificate on Coursera form others is the access to Meta Job board

Sunday, October 15, 2023

Top 6 Books to Learn and Master Programming and Coding - Must Read, Best of Lot

Coding is an integral part of Programming, and we all somehow learned to code by following examples here and there. Yes, I am talking about both self-taught programmer and Computer Science Graduates. You can learn Coding easily if you are dedicated, but what is more difficult is to write good code. You can easily find programmers in Java, C++, Ruby, or Python, but finding programmers, who are also a good coder is very difficult. Some universities have a good curriculum and practical classes to teach coding better than others, but most of these great coders are self-taught Programmers, who learned by reading books, joining online courses, and doing things on their own.

Wednesday, October 11, 2023

Top 7 Courses to learn Data Structure and Algorithms in 2024 - Best of Lot [UPDATED]

Hello guys, both Data Structures and Algorithms are one of the most essential topics for programmers and if you want to learn Data Structure and Algorithms in 2024 then you have come to the right place. The best thing about them is that they never get out-of-date, and any investment you made in terms of time and money will pay rich dividends for a long time. I have also found that people good at algorithms and data structures are often better programmers than others. They tend to improve your programming skill and coding sense, and that's the main reason I suggest all kinds of programmers, from junior to senior to spend some time revising, refreshing, and honing their data structure and algorithm skills.

Tuesday, October 10, 2023

How to fix Eclipse - Could not reserve enough space for object heap in Java? Solution

If you are running Java program in Eclipse and ever tried playing with -Xmx parameter you know about those virtual machine initialization error e.g. "“Error occurred during initialization of VM; Could not reserve enough space for object heap”. This error usually occur when you to try to give your program, running on 32-bit JVM more than 1.4G of memory in Eclipse in Windows. It doesn't matter how much memory your machine have e.g. I have seen this error in laptops running 4GB of memory. The important thing which matter is whether JRE or JVM you are using with Eclipse is 32-bit or 64-bit. If you use 64-bit JRE in Eclipse, you can potentially allocate more than 1.4G of memory in Windows itself.

Monday, October 9, 2023

How to fix java.net.SocketException: Connection reset by peer: socket write error? [Solved]

"Exception in thread "main" java.net.SocketException: Software caused connection abort: socket write error" comes when you are writing into a connection which is already closed by your peer i.e. the other party in the connection. For example, if you are server and sending response to client but client closed its connection before you complete writing response, the write() method of DataOutputStream will throw this error. It's not necessary that this error will only come when you are using DataOutputStream, it can come even if you are just using and OutputStream or SocketOutputStream point is you are writing in a socket which is closed by other end. Here is the actual error message with stacktrace:

Sunday, October 8, 2023

2 Ways to remove whitespaces from String in Java? Example Tutorial

You can remove blanks for whitespaces from a Java String by using the trim() method of java.lang.String class of JDK API. Unlike SQL Server which have LTRIM() and RTRIM() methods to remove whitespace from String, Java doesn't have ltrim() and rtrim() methods to trim white spaces from left and right, instead it just have a trim() method which removes all spaces from String including space at the beginning and at the end. Since String is Immutable in Java, it's worth noting that this method return a new String if original String contains space either at beginning or end, otherwise it will return the same String back. 

Friday, October 6, 2023

How does Remember Me functionality works in Spring Security?

In the last article, You have learned how to enable the remember-me functionality in Spring security and today you will learn how does Remember Me work under the hood. So far, you know that remember-me functionality uses cookie to remember users and allow auto-login (without entering password again), so you might have guessed that spring security provides hooks to generate that cookie as well as process those cookie when an already signed user open the application after the break e.g. after a day or two. As long as cookie is not expired and token is valid i.e. user hasn't changed the password, he should be able to login to your application. 

Wednesday, October 4, 2023

6 ways to sort ArrayList in Java 8? List.sort() + Collections.sort() Example Tutorial

There are many ways to sort an ArrayList in Java 8; for example. you can use the old but still rocking way to sort a List by using Collections.sort() method, or you can use the newly added sort() method in the List interface in Java, or you can use the new java.util.stream API to sort a list of objects. You now have multiple choices when it comes to sort a List or Array in Java. Though, my preferred way is Collections.sort() method because it is available to all the Java versions and its easy to use and it also allows you to sort in any custom order.  The method is overloaded which gives you ability to sort a list of objects into their natural order as well allow you to supply a Comparator of your choice to sort elements into customer order. 

Tuesday, October 3, 2023

How to enable RememberMe Functionality in Spring Security

Hello guys, most of the web application has login or authentication functionality where user need to enter their username and password to access functionalities provided by application. This is great from application's perspective because functionalities are protected from anonymous user but from user's perspective he would appreciated something which would not ask him/her to enter username and password every now and then. This is what remember me functionality of Spring security does. It allow you to build a web application which can remember their user and allow them to automatically login when the restart their browser or come back another day. 

Top 5 Online Courses to learn gRPC and Google Protobuf in Java, Python, Golang & C# in 2024 - Best of Lot

If you are a Java developer then you might have heard about the gPRC, the Google Remote Procedure Call solution. It's the latest buzz in the tech circle, and people are talking enthusiastically about it. The buzz is evident because it's coming from Google like Angular, Golang, Flutter, Dart, TensorFlow, and other latest technologies. For those who don't know, gRPC is a super-fast, super-efficient Remote Procedure Call (PRC) system that will help you to develop distributed systems like Microservices. This means you can use gPRC to communicate between your Microservices at super-fast speed.  Similar to other RPC solutions like SOAP, it allows a client application to call a method on the server as it is a local object. The server defines service and indicates that it can be called remotely with method parameter and return type and then provides implementation and an RPC server that can handle client calls.

Monday, October 2, 2023

Top 5 Online Courses to Learn MongoDB NoSQL Database in 2024 - Best of Lot

MongoDB is one of the leading NoSQL databases and it was on my radar for a long time but I never get a chance to learn or work on it, but Recently I got an opportunity to use MongoDB for one of our projects and I learned a lot on the way. In this article, I will introduce MongoDB and how to learn MongoDB so that you can use it in your project. In this article, I will share some of the online courses which I have taken to understand everything up to the basic CRUD (Create, Retrieve, Update, Delete) operations on MongoDB. I have also read a couple of books and followed some tutorials but these courses were my main source to learn Mongo DB.