Sunday, September 15, 2024

Coding Interview Cheat Sheet and Resources for Developers

Hello guys, are you looking for job in this tough market? Well, its not easy and market is flooded with a lot of talented people, thanks to what happening in the world. But that should not be an excuse. If you can refer right resources and put in efforts you can still get job, all comes down to how badly you want and how good is your preparation. In the past, I have shared best coding interview books and courses as well as many coding interview questions on String, Array, LinkedList, Binary Tree, Matrix, Recursion, Algorithms, and in general DSA. Today, I am going to share a gist of all these and I will share a coding interview cheat sheet with right resources so that you can get ready for coding interview in minimal amount of time.

Saturday, September 14, 2024

Top 5 React and Redux Courses to Learn Online in 2024 - Best of Lot

If you are a Web developer or someone passionate about web development and looking for some awesome courses to learn React or React JS, a popular JavaScript framework to develop a component-based user interface then you have come to the right place. Facebook's React library has taken the front-end development world by storm. More and more people have started using React even in favor of Google's Angular, another popular front-end development framework. Well, I am not going into the classic debate of Angular vs React as both the framework has their own advantage and disadvantage but if you have chosen to learn React, you have made the right decision.

Friday, September 13, 2024

How to design a Messaging App like Twitter on System Design Interview?

Hello guys, if you are preparing for system design interview and looking for common System deign problems and resources then you have come to the right place. In the past, I have shared best System Design courses, books, websites, newsletters, cheat sheets, mock interviews, blogs, tips, GitHub repo, and 100+ System Design Interview Questions and Problems and today I am going to discuss one popular System deign problem — designing Twitter or X.com. Designing a complex system like Twitter can be challenging, especially in a system design interview.

Top 10 Coursera Certifications and Courses to Learn Python in 2024 - Best of Lot

While there are many online platforms out there to learn Python Programming from scratch, Coursera is one of the most popular and reputed websites to learn Python for beginners. The best thing about Coursera is that it provides access to courses taught at the World's top universities like the University of Michigan and Rice University, one of the top 20 universities in the USA. It has also got the best Python certifications offered by the world's most reputed companies like IBM and Google and the world's top universities like the University of Michigan and Johns Hopkins University. That's why many people flock to Coursera to learn Python and other Computer Science and Software Engineering skills.

Thursday, September 12, 2024

Top 10 Java Programming Courses for Beginners to Learn Online in 2024 - Best of Lot

If you are a computer science graduate or someone who wants to learn Java and looking for some awesome resources like books, tutorials, and online courses then you have come to the right place. In the past, I have shared some great books, websites, and tutorials to learn Java and in this article, I am going to share some of the best Java courses beginners can join to learn Java in 2024. One of the main problems with learning Java is keeping pace with the increasing number of releases. For example, Java 8 release completely changed how Java is written and after that, we have many Java releases in the form of Java 9Java 10, Java 11, 12, 13, 14, 15, 16, and now Java 17. But the good thing is that the core of Java is still the same and all its releases are backward compatible.

Wednesday, September 11, 2024

The 2024 Data Analyst Roadmap

Hello guys, if you are want to become a Data Analyst in 2024 but not sure which skills you need and how to acquire those skills then you have come to the right place. Earlier, I have shared the Java Developer RoadMap, Python Developer RoadMap, Web Developer RoadMapiOS Developer RoadMap, and  DevOps Engineer RoadMap, and in this article, I will share the 2024 Data Analyst RoadMap which will help you to become a Data Analyst in 2024. As we continue to witness unprecedented growth in data generation across industries, the role of a data analyst has become more pivotal than ever. 

Parsing Large JSON Files using Jackson Streaming API Example

In the last couple of JSON tutorials for Java programmers, we have learned how to parse JSON using JSON-Simple library, parsing JSON array to Java array using GSon, and in this tutorial, we will learn how to parse a large JSON file in Java using Jackson's Streaming API. Jackson is one of the most popular JSON processing frameworks and provides three main models to parse and process JSON data including Streaming API, data binding, and tree model. Out of these three, Streaming works at the lowest level and can be used to parse huge JSON responses up to even gigabytes of size. If you are familiar with XML parsing, then you know that how difficult it is to parse huge XML files with DOM parser because it fully loads the file in memory before you can process it.

Tuesday, September 10, 2024

6 Websites to Learn Linux Command Line for FREE - Best of Lot

Hello guys, if you want to learn Linux online and are looking for free resources to learn Linux commands and concepts, you have come to the right place. Earlier, I have shared Linux and shell scripting courses and tutorials, and in this article, you will find the best places to learn Linux online. Linux is one of the most useful skills for Programmers and Developers, and there are a lot of useful resources on the internet to learn Linux and master Linux command lines or bash shells. In this article, I will share websites where you can learn Linux for FREE. I have tried to include a variety of websites like Udemy and Coursera for online courses, CodeCademy and Educative for online interactive learning, and Pluralsight as a membership-based website. 

How to Ignore Unknown Properties While Parsing JSON in Java? Example

One of the common problems while parsing JSON in Java using Jackson API is that it fails when your JSON contains unknown properties i.e. your Java class doesn't have all the fields corresponding to all JSON properties. For example, if you are consuming JSON from a REST Web Service and tomorrow they added a new field into JSON then your code will break because Jackson will throw UnrecognizedPropertyException and stop parsing JSON. This is troublesome and can cause problems in production if you are not aware. I  have faced this issue when a developer shipped the code to consume data from REST API without properly handling unknown fields.

Sunday, September 8, 2024

How to parse JSON with date field in Java - Jackson @JsonDeserialize Annotation Example

I have read many articles on parsing JSON in Java and most of them give examples where properties are either String or int, there are very few examples, where you will see the JSON string contains a date field and that's one important thing to learn. It's easy to parse JSON in Java using Jackson or Gson with just integer and string field but you need to do a little more work if your JSON contains a date field because everything in JSON is String but Java is a type-based programming language, where Date is a type.

Saturday, September 7, 2024

Top 5 JSON Library Java JEE Developers Should Know- Best of Lot

The JSON format is one of the most popular formats to transfer and exchange data on the web. Almost all RESTful web services take JSON input and provide JSON output but unfortunately, JDK doesn't have built-in support for one of the most common web standards like JSON. As a Java developer if you want to develop a RESTful web service and produce JSON data or if you are developing a client to existing RESTFul web services and want to consume JSON response, you don't need to be disappointed. Fortunately, there are so many open source libraries and APIs available for creating, parsing, and processing JSON response in Java, like Jackson, Google GSon, json-simple, etc.

Friday, September 6, 2024

10 Best Practices to Follow While Writing Code Comments

Comments are an important part of writing code not only in Java but whatever programming or scripting language you use. At the same time, this is one of the most abused things as well. Both writing no comment and writing too much comment is bad and this has been highlighted by many software gurus e.g. Robert C. Martin in his classic book Clean code. There is a whole chapter dedicated to How to write comments and finding the pros and cons of a comment. This article is my learning in the same direction, here I am going to share with you guys some 0f the rule and best practices I follow while writing comments.

6 JDBC Performance Tips for Java Developers

JDBC Performance tips are a collection of some tried and tested ways of coding and applying process which improves the performance of JDBC code. The performance of core Java application or J2EE web application is very important, especially if its user database in the back end which tends to slow down performance drastically. do you experience your java j2ee web application being very slow (taking few seconds to process simple requests which involve database access, paging, sorting, etc) then the below tips may improve the performance of your Java application? these tips are simple in nature and can be applied to other programming language application which uses the database as back-end. 

Dealing with Password in Java Application? 5 Best Practices You Should Follow

While working in core Java applications or enterprise web applications there is always a need of working with passwords in order to authenticate users. Passwords are very sensitive information like Social Security Number(SSN) and if you are working with real human data like in an online banking portal or online health portal it's important to follow best practices to deal with passwords or Social security numbers. here I will list down some of the points I learned and take care of while doing authentication and authorization or working with passwords. I recommend reading more on this topic and have a checklist of things based on your application requirement. Anyway here are few points which make sense to me:

Wednesday, September 4, 2024

How to create Immutable Class and Object in Java - Tutorial Example

Writing or creating immutable classes in Java is becoming popular day by day, because of the concurrency and multithreading advantage provided by immutable objects. Immutable objects offer several benefits over a conventional mutable object, especially while creating concurrent Java applications. Immutable object not only guarantees safe publication of object’s state but also can be shared among other threads without any external synchronization. In fact, JDK itself contains several immutable classes like String, Integer, and other wrapper classes.

What is difference between Enumeration and Iterator in Java? Answer

Though both Iterator and Enumeration allows you to traverse over elements of Collections in Java, there is some significant difference between them e.g. Iterator also allows you to remove elements from the collection during traversal but Enumeration doesn't allow that, it doesn't get remove() method. Enumeration is also a legacy class and not all Collection supports it e.g. Vector supports Enumeration but ArrayList doesn't. On the other hand, Iterator is the standard class for iteration and traversal. By the way,  what is the difference between Enumeration and Iterator in Java? 

Tuesday, September 3, 2024

Dealing with org.hibernate.LazyInitializationException: could not initialize proxy - no Session in Hibernate Java

If you are working in the Hibernate framework, then you know that one of the key features of Hibernate is "lazy initialization", which allows the framework to lazily initialize dependencies, relationships, or associations lazily from the database on a need basis. For example, if you are dealing with a User object, which has a relationship with a Permission object like one user can have multiple permissions, then Hibernate may choose not to initialize the collection which holds all permissions at the time it initialized User object and instead returns a proxy object.

How to fix org.hibernate.MappingException: Unknown entity Exception in Java? Solution

If you have used Hibernate with JPA and using annotation to declare your entity bean then you might have seen this confusing error called "org.hibernate.MappingException: Unknown entity". This error message is so misleading that you could easily lose anywhere between a few minutes to a few hours looking at the wrong places. I was using Spring 3 and Hibernate 3.6 when I got this error, which occurs when addEntity() method was executed. I checked everything, from Spring configuration file applicationContext.xml, Hibernate config file, my Entity class, and DAO class to see whether my Entity class is annotated or not, but I was still getting this error message.

Why JPA Entity or Hibernate Persistence Class Should Not be Final? Answer

One of the interesting hibernate interview questions is, why you should not make a Hibernate persistent class final? I'll try to answer this question in this short blog post. The use of proxies is the core feature of Hibernate (one of the most popular ORM frameworks for Java Projects) for implementing key performance features e.g. lazy loading and lazy associations fetching. In order to use a proxy in place of a real class, your hibernate persistence class must be either non-final or the implementation of an interface that declares all of the public methods. 

Monday, September 2, 2024

10 Difference between Hibernate and JDBC in Java

JDBC is the core technology to access database from Java application but it require lot of boiler plate coding. Hibernate on the other hand an ORM (Object Relational Mapping) framework, which automatically map Java object to tables and records in database. You don't need to execute query to populate objects, Hibernate will do that for you. It also provides several benefit as compared to JDBC e.g. performance improvement via Proxy, lazy loading of associations and Caching, that's why both enterprise Java application and web application uses Hibernate to implement the DAO layer of application.

Tuesday, August 27, 2024

10 Examples of Conditional Breakpoint Debugging in Java and Eclipse

Eclipse is a great tool for Java developers, it allows you to write code, execute them and debug them but many developers doesn't use Eclipse to their full potential. I focus a lot of debugging skills when I take interviews and when I ask about how they debug their Java application, many developer mention use of line breakpoint and only few mention about conditional breakpoint. To be honest, if you are debugging a real-world Java application which has lots of users, clients or data then line breakpoint will not be very helpful and it will take ages to find the most of the data related issues. 

For example, somewhere in your code you getting a NullPointerException and ArrayIndexOutOfBoundsException and you are not sure for which client, user or value this error came. 

Monday, August 26, 2024

The 2024 Java Developer RoadMap [UPDATED]

Hello guys, I have been sharing a lot of roadmaps to become a Web developer, DevOps engineer, and recently React.js developer. One of the requests I received from many of my readers was for creating a Java Developer Roadmap. Since Java is my expertise, It wasn't a problem to create a Java Developer Roadmap, but it took slightly longer for me to create one because of the limited time I get. Anyway, I am finally ready to share my Java developer RoadMap with you. This Roadmap contains my years of experience and the unobstructed path of how to become a Java expert. It answers many burning questions like which technologies a Java developer should learn? What tools make you a better Java developer? And, which framework a Java developer must absolutely learn.

Saturday, August 24, 2024

Top 10 Object-Oriented (OOP) Design Principles Java Programmers Should Know

The Object-Oriented Design Principles are the core of OOP programming, but I have seen most of the Java programmers chasing design patterns like Singleton pattern, Decorator pattern, or Observer pattern, and not putting enough attention on learning Object-oriented analysis and design. It's essential to learn the basics of Object-oriented programming like Abstraction, Encapsulation, Polymorphism, and Inheritance. But, at the same time, it's equally important to know object-oriented design principles. They will help you to create a clean and modular design, which would be easy to test, debug, and maintain in the future.

Top 5 Concurrent Collections Java Programmer Should Learn (with Examples)

Several new Collection classes are added in Java 5 and Java 6 especially concurrent alternatives of standard synchronized ArrayList, Hashtable and  synchronized HashMap collection classes. Many Java programmer still not familiar with these new collection classes from the java.util.concurrent package and misses a whole new set of functionality which can be utilized to build more scalable and high-performance Java application. In this Java tutorial, we will some of the useful collection classes like ConcurrentHashMap, BlockingQueue which provides some of the very useful functionalities to build concurrent Java applications.

Friday, August 23, 2024

10 Example of this keyword in Java

this keyword in Java is a special keyword that can be used to represent the current object or instance of any class in Java. “this” keyword can also call the constructor of the same class in Java and is used to call overloaded constructor. In this Java tutorial, we will see how to use this keyword in Java and different examples of this in Java. this sometimes also associates with a super keyword which is used to denote an instance of the superclass in Java and can be used to call an overloaded constructor in Java.

Top 11 Java ConcurrentHashMap Interview Questions with Answers [UPDATED]

The ConcurrentHashMap class part of concurrent collections package added on JDK 1.5 which contains utility classes like BlockingQueue, CopyOnWriteArrayList, CopyOnWriteArraySet etc. It is a replacement of synchronized hash-based map implementations e.g. Hashtable and synchronized HashMap. It implements Map and ConcurrentMap (a sub-interface of Map) interface which allows you to store key-value pairs. The class is similar to HashMap or Hashtable but it's more scalable and the right fit for concurrent Java application. Unlike Hashtable which achieves its thread-safety by compromising the scalability, ConcurrentHashMap uses advanced techniques e.g. dividing the map into segments to remain thread-safe and scalable at the same time.

10 Financial Information Exchange (FIX) Protocol Interview Questions from Investment Banks

Here are some of the common questions asked on any  FIX (financial information exchange)  protocol or financial interview on investment bank. Most of these are asked to Java developer who needs to work in Cash Equities and FIX Engines but they are also important for Business Analyst, Quality Analysts and Support Analysts. These questions are just some on top of my mind please add any other questions you have faced in your financial interview position , I would add them in list.
  1. · What is an Exchange?
  2. · What is the difference between a Stock and a Bond?
  3. · What is the difference between Sell Orders and Short Sell Orders?
  4. · What is naked short and what is covered short?
  5.   What is the difference between an ECN and an exchange?
  6.   What is the difference between an ECN and an exchange?
  7. · What is FINANCIAL INFORMATION EXCHANGE (FIX) Protocol?
  8. · What is limit order?
  9. · What is a market order?
  10. · What is a stop or stop loss order?

How to use JList in Java Swing GUI? Tutorial Example

In this java swing JList tutorial, we will learn important properties and function of JList while working on a task with examples. In my opinion best way to learn swing is to actually doing the task and so I designed this tutorial around the task. We will start with a simple example and proceed with more  complex one step by step adding new functionality and in the course, we will learn JList both concept and API. In this first example, we need to implement a list which shows names of companies in sorted order. 

Wednesday, August 21, 2024

What is Assertion in Java? When and How to use in Code? Example

Where and when to use Assertion in Java is probably the most important thing you want to know about Assertions. In last couple of articles we have seen What is Assertion in Java and How to enable or disable Assertion in Java while in this article we will discuss most important part “Where to use Java Assertions” as I have always said Java Assertion should be taken as replacement of JUnit testing or Exception in Java Instead Assertion compliments both Unit testing and Exception and if used property provides you another testing tool which may test application with more real data than JUnit tests.

How to enable or disable Assertion in Java? Example Tutorial

The good thing about Assertion in Java is that you can enable or disable Assertion at runtime. The designer of Java are really very thoughtful, they have thought of many situations while designing Java and its API. One of the gems is the ability to enable or disable assertion in runtime without any change on code and no new deployment. You can just change a JVM parameter and enable or disable assertions. While most of you have used Assertions with JUnit assert API and familiar with methods like assertEquals(), the Java assertions is bit different than that. 

Tuesday, August 20, 2024

Top 12 Java 8 Stream Examples for Beginners

The java.util.stream.Stream class is one of the most useful class of Java 8 API. If I have to say that this is the class you would be using mostly while coding in Java 8 then it won't be an exaggeration. Since Stream class is integrated with Collection framework, you will end up using Streams for most of your day to day programming task in Java 8. It has several useful methods e.g. map() to convert one type of collection to other, flatMap to flatten a collection of collection, forEach to iterate over Collection, filter to selective remove elements from collection.

Monday, August 12, 2024

How to find top 5 largest files and directories by size in Linux? Example

One of the common Linux interview question to developer is "Print top 5 largest directories in Linux using du command". In the past, I have shared 30 UNIX command interview questions and Linux interview questions and today, we will discuss this problem and learn what to do if it comes on interview, or more likely you face this in your day to day work as developer, IT support or System administrator.  If Interviewer ask you to print top 5 biggest directories by size instead of files then you can use the du (disk usage) command to find directories. The du command will list down size of every file and directory and then you can use the sort command to sort them in descending order by using -n and -r option. 

Thursday, August 1, 2024

Top 50 Hibernate and JPA Interview Questions Answers for 3 to 5 Years Experienced Java developers

Hello guys, if you are preparing for Java developer interview then apart  from preparing core Java questions like Collections, Multithreading, Serialization, and Data Structures you should also prepare Spring Boot and Hibernate interview questions. Both Spring and Hibernate are two of the essential frameworks in Java world and its expected from an experienced Java developer to know them. I have given more than 50 interview in my career and in most of them I have seen questions from both Spring and Hibernate, especially on the jobs where Hibernate and Spring Framework is mentioned as required skills. 

Wednesday, July 24, 2024

What is the delegating filter proxy in Spring Security? How it works?

The Delegating filter proxy or DelegatingFilterProxy is a spring aware class which implements javax.servlet.Filter interface and used to activate Spring security in a web application. Since Filters are created and maintained by Servlet or Web Container this filter is declared in web.xml and it is configured to process request for all URLs, which means every request and response pass through this filter. In other words, DelegatingFilterProxy works as a proxy between Web Container and Spring Container. It passes all request and response to Spring Security to implement security constraints e.g. performing authentication or authorization. 

5 Ways to Loop or Iterate over ArrayList in Java?

Looping over an ArrayList in Java or Iteration over ArrayList is very similar to a looping Map in Java. In order to loop ArrayList in Java, we can use either foreach loop, simple for loop, or Java Iterator from ArrayList. We have already touched iterating ArrayList in 10 Example of ArrayList in Java and we will see them here in more detail. We are going to see examples of all four approaches in this ArrayList tutorial and find out which one is clean and the best method of looping ArrayList in Java? But, before start writing an example for loop in ArrayList let's think about why do we need to iterate, traverse or loop an ArrayList if it’s based on the index and backed by Array.

Saturday, July 20, 2024

How to get the selected radio button on click using jQuery? Example Tutorial

In last couple of articles, you have learned how to get all checked checkbox and how to find the unchecked checkbox using jQuery, let's see another similar example, this time with radio button. Suppose, in form you have two radio buttons to select the gender i.e. male and female. How do you find which radio button was selected when user clicked on them? well, we will use the jQuery selector to find that. In fact, its not much different than what you have used to find the checked checkbox i.e. $("input[type=radio]:checked") will give the selected radio button. In order to find the chosen radio button when user click, you need to bind a click handler.

Friday, July 19, 2024

10 Example of Hashtable in Java – Java Hashtable Tutorial

Hello Java programmers, if you are wondering how to use Hashtable class in Java then you have come to the right place. In this Java Hashtable tutorial, I am going to share how to use Hashtable in Java with examples. These Java Hashtable Examples contain some of the frequently used operations on Hashtable in Java. when I discussed throw of How HashMap or Hashtable works in Java I touched based on the inner working of Hashtable, while in this Java Hashtable tutorial we will see more examples of Hashtable in Java like checking a key exits in HashMap or not or get all keys and values from HashMap, Iterating on Hashtable keys and values using Enumeration, checking if Hashtable contains a particular key or value, how to copy mappings from a Hashtable to HashMap in Java, etc.

Thursday, July 18, 2024

How to sort a Map by keys in Java 8 - Example Tutorial

Hello Java friends, In the last article, I have shown you how to sort a Map by values in Java 8, and in this tutorial, you will learn how to sort a Map by keys like a HashMap, ConcurrentHashMap, LinkedHashMap, or even Hashtable. Theoretically, you cannot sort a Map because it doesn't provide any ordering guarantee. For example, when you iterate over a HashMap, you don't know in which order entries will be traversed because HashMap doesn't provide any ordering. Then, how can you sort a Map which doesn't support order? Well, you can't and that's why you only sort entries of HashMap but you don't store the result back into HasMap or any other Map which doesn't support ordering. If you do so, then sorting will be lost.

Wednesday, July 17, 2024

Top 30 Array Interview Questions and Answers for Programmers

The array data structure is one of the most important topics for programming interviews. It doesn't matter if you are going to Google, Microsoft, Amazon or investment banks like Goldman Sachs, Barclays, Citi or even service-based companies like IBM, Accenture, TCS, or Infosys, if you are going to interview for the developer position, you must prepare array very well. In fact, it is the second most topic after String and if you look closely, may of String coding problems can be solved by treating them like character array. The array is also ubiquitous, no matter which programming language you choose, you will find array there, it's available in C, C++, Java and even on Python, Perl, and Ruby.

Monday, July 15, 2024

What is WeakHashMap in Java? When to use it? Example Tutorial

WeakHashMap is an implementation of Map interface in Java. It's a special Map where entries can be reclaimed by Garbage collector if there is no more strong reference exists to the value, apart from the key in the WeakHashMap, which is anyway the weak reference. This property allows a WeakHashMap to be used as Cache, where Garbage Collector can automatically cleanup dead entries. I mean those objects which are only alive inside map but there is no outside entries. Worth noting is that the key are stored as WeakReferences inside WeakHashMap which allows values to be reclaimed if there is no strong reference exists outside.

Sunday, July 14, 2024

17 SQL Query Best Practices Every Developer Should Learn

Hello guys, its no secret that SQL is one of the must have skill in this data driven world and its also one of those skills which is equally useful for programmers, developers, database admins, data scientists, data analyst, business analyst, quality analyst and even project managers. I first learned SQL 20 years back when I was in college and that time we are using Oracle database. I still remember my first query about "SELECT * FROM EMP",  EMP was one of the tables which was quite popular among learners and most of the Oracle DB instance on labs have that. 

Friday, July 12, 2024

How to declare and initialize two dimensional Array in Java? Example Tutorial

There are many ways you can declare a two-dimensional integer array in Java. Since 2D array in Java is nothing but an array of array, you can even declare array with just one dimension, the first one; second dimension is optional. You can even declare a 2 dimensional array where each sub array has different lengths. You can also initialize the array at the time of declaration or on some later time by using nested for loop. So there is lots of flexibility. In this article, you will learn common Java idioms to declare and initialize two dimensional arrays with different lengths. 

What is lazy loading in Hibernate? Lazy vs Eager loading Example

Lazy loading in Hibernate is a feature which allows Hibernate to load the dependent objects lazily to improve performance of Java application. By default Hibernate does eager or aggressive loading for single valued associations (many to one and one-to-one ) and lazy loading for collection-valued associations (one to many or many-to-many). If you set the loading to lazy=false or FetchType.EAGER then object will be eagerly loader, means when an object is loaded from database all its relationship and associated objects are also loaded from Database e.g. when an Author entity object is initialized then all the books written by this author will also be loaded into memory.

Wednesday, July 10, 2024

Difference between @Secured vs @RolesAllowed vs @PreAuthorize, @PostAuthorize Annotations in Spring Security

Spring Security is a powerful framework to implement security on Spring based Java web application as well as on security RESTful Web Services. It also provides method level security, which means restricting access to a method depending upon role and permissions of object. If a user calling the method has access the method will be executed, otherwise AccessDeniedException will be thrown by Spring Security. All these annotations e.g. @Secured, @RolesAllowed, @PreAuthorize, and @PostAuthorize is used to implement method level security in Spring security, but there are some subtle difference between them. 

How to reverse an ArrayList in place in Java? Example [Solved]

How to reverse an ArrayList in place is a popular coding interview problem, not just on Java interviews but also for other programming language. I often ask to check whether candidate is familiar with in place algorithms or not.  You can reverse an ArrayList in place in Java by using the same algorithm we have used to reverse an array in place in Java. If you have already solved that problem then It's a no-brainer because ArrayList is nothing but a dynamic array, which can resize itself. All elements of an array are stored in the internal array itself. 

Tuesday, July 9, 2024

How to Remove Duplicates from Array without Using Java Collection API? Example

This is a coding question recently asked to one of my readers in a Java Technical interview on investment bank. The question was to remove duplicates from an integer array without using any collection API classes like Set, HashSet, TreeSet or LinkedHashSet, which can make this task trivial. In general, if you need to do this for any project work, I suggest better using the Set interface, particularly LinkedHashSet, because that also keeps the order on which elements are inserted into Set. Why Set? because it doesn't allow duplicates and if you insert duplicate the add() method of Set interface will return false. 

12 Apache HTTP Server Interview Questions Answers for 1 to 3 years Experienced

Hello guys, if you are preparing for Java web developer interviews then you must prepare questions on Apache HTTP web server, one of the most popular web server on internet. Knowing how Apache Web Server works not only shows that you have practical experience but also demonstrate your attitude about learning things in depth. The Apache HTTP Server, also known as httpd, has been the most popular web server on the Internet since April of 1996. It is both free and robust and that's the reason that almost half of the world's websites  runs on Apache HTTP web server, ranging from small hobby websites to huge e-commerce giants and big banks. 

Monday, July 8, 2024

17 Scenario Based Debugging Interview Questions for Experienced Java Programmers

If you are a beginner or an experienced Java developer with 1 to 3 years of experience under your belt, when you go for a Java interview you should prepare some Java troubleshooting and debugging interview questions like how to debug a Java program running in Linux environment? have you done remote debugging? have you ever profile your application? Your application is getting OutOfMemoryError, how are you going to find the root cause and fix? etc. These types of scenario based questions are quite popular while interviewing 5 to 10 years experienced Java developers to see their hands-on knowledge and find out they are rusty or not. 

Sunday, July 7, 2024

10 Singleton Pattern Interview Questions in Java - Answered

Singleton design pattern is one of the most common patterns you will see in Java applications and it’s also used heavily in core Java libraries. Questions from the Singleton pattern are very common in Java interviews and good knowledge of how to implement the Singleton pattern certainly helps. This is also one of my favorite design pattern interview questions and has lots of interesting follow-ups to dig into details, this not only checks the knowledge of design pattern but also checks to code, multithreading aspect which is very important while working for a real-life application.

Saturday, July 6, 2024

14 Multicasting Interview Questions and Answers

Hello guys, Multicasting is an important concept for Java developers, particularly those working on high frequency low latency Java application like trading apps, client connectivity and exchange connectivity systems, order management systems (OMS), Algorithm trading system, and smart order routers. As it provides a faster way to deliver messages than TCP. Yes, Multicasting is usually UDP based which is faster than TCP. While UDP doesn't guarantee message delivery, you can use things like sequence number to track messages and replay if a message went missing. Since multicasting is heavily used on big investment banks like JP Morgan, Barclays, Citi, Morgan Stanley, and others on their Java applications, its also an important topics for interviews. Not just on banks but also on many product based companies. 

Friday, July 5, 2024

Top 20 Algorithms Interview Problems for Programmers and Software Engineers

Hello All, If you are preparing for Programming job interviews or looking for a new job then you know that it's not an easy task. You got to be lucky to get a call from recruiter or hiring manager and make it to the first round of interview at any stage of your career but it is even more difficult at the beginner level when you are searching for your first job. That's why you can't just take your chance lightly. You got to be prepared to grab that chance and for that, you must know what is expected from you on the coding interview. What type of questions is asked, what topics should you prepare, etc? 

Wednesday, July 3, 2024

How HashMap works in Java?

Hello guys, if you are looking for an answer of popular Java interview question, how HashMap works in Java? or How HashMap works internally in Java then you have come to the right place. In this article, I will not just answer those question but also many related questions like How get() and put() method works in Java? what role equals() and hashcode() play in HashMap, How HashMap resize itself, and why key object of HashMap should be Immutable in Java. Let's start with the basics first. HashMap in Java works on hashing principles. It is a data structure that allows us to store object and retrieve it in constant time O(1) provided we know the key. Also this is one of my most popular article with more than 6 million views and I have now updated it to include latest information like how HashMap now uses a balanced tree instead of linked list for storing collision objects and new diagrams on HashMap working which provide visual explanations. 

Tuesday, July 2, 2024

Top 12 SQL Query Problems for Coding Interviews (with Solutions)

Hello guys, if you are looking for SQL query examples from interviews or SQL Query Practice questions to improve your SQL skill or just to prepare for tech interviews  then you have come to the right place. Earlier, I have shared best websites to learn SQL and Practice Query online and in this article, I am going to share 12 popular SQL query questions from interviews. SQL is an important skills for both programmers and data scientist, even people from QA and BA stream also need to know SQL to do their job well in this era or data driven world. That's why SQL queries are also quite popular on interviews. 

Monday, July 1, 2024

Top 50 Java Programs from Coding Interviews

Coding problems are an integral part of any programming job interviews, and Java development interviews are no exception. I would even suggest you should never hire anyone without testing their coding skill, but coding is also an art, and more often than a good coder is also an excellent developer. If you look at tech giants like Amazon, Facebook, and Google they thoroughly test the coding skill of any developer they hire, notably Amazon who first send online coding exercises to filter Java programmers who can code from those who can't code. This online test usually gives you requirements and ask you to write a program in a limited time, usually 2 to 3 hours. The application should meet the output provided by the exercise itself. These type of tasks are very tough to crack if you don't have excellent coding skill.

42 Programming Interview Questions for 1 to 3 Years Experienced Programmers (with Answers)

Hello guys, if you are preparing for programming job interviews and looking for previous asked questions or popular questions to get idea what topics are important for interviews then you have come to the right place. In the past, I have shared system design questions, SQL questions, UNIX questions and Java questions and in this article, I am going to share 42 programming interview questions for 1 to 3 years of experienced programmers. Though, its also useful for programmers up to 5 years of experience and we will start with programming questions from telephonic round of interviews. Due to COVID and work from home culture, in the last few years, phone interviews also known as the telephonic round has become the single most popular way to screen candidates in a programming job interview. It's easy for both parties to gauge each other, the candidate doesn't need to travel to the prospective Employer's premises and the Interviewer also doesn't need to make any unnecessary arrangements. 

Saturday, June 29, 2024

How to Create a TCP Client and Server in Java? Example Tutorial

Hello guys, if you want to create client server application in Java then you need to learn Java networking API an classes like Socket and ServerSocket. In the past, I have showed you how to create an HTTP Client and Server in Java where I talked about these classes. In this Java networking tutorial, we will learn how to create a simple TCP server and Client in Java using networking classes provided by JDK in java.net package. Earlier, I have showed you how to create HTTP Server, which is actually a TCP/IP Server but here we'll do it again, along with writing a TCP client as well. Though you can test your TCP server using telnet, I'll show you how to connect to it using a TCP client written in Java. 

Monday, June 24, 2024

Top 5 SQL Server Tips for Beginners and Junior DBAs

Hello guys, If you are using Microsoft SQL Server database and use SQL Server Management Studio in your day to day work and looking for SQL Server tips to improve productivity and work fast and efficiently then you have come to the right place. Earlier, I have shared SQL Server online courses, SQL Server Interview questions and SQL Server Management Studio keyboard shortcuts and today, I am going to share amazing tips to make most of SSMS. These are the tips I learned hard way after working close to 8 years on SQL Server backend.

Sunday, June 23, 2024

How to find smallest number from int array in Java, Python, JavaScript and Golang? [Solved]

This is the second part on this array interview question. In the first part, I have showed you how to find the largest element in array, and in this part, you will learn how to find the smallest number from an integer array. We will solve this problem on Java programming language but you are free to solve in any other programming language like Python or JavaScript. Most interviewer doesn't care much about which programming language you are solving the question, if you can provide working solution. This one is also a popular Java programming exercise which is taught in school and colleges and give in homework to teach programming to kids and engineering graduates. 

Friday, June 21, 2024

How to update an entity using Spring Data JPA ? Example Tutorial

Hello Java programmers and Spring Boot developers, if you are wondering how to update an entity using Spring Data JPA and looking for a tutorial or example then you have come to the right place. Earlier, I have shared the best Spring Boot courses and best Spring Data JPA Courses and in this article, I will show you how you can update any entry using Spring Data JPA?. How to update an entity using spring-data-JPA is also a  must-know topic when it comes to spring application development. Query methods are supported by Spring for updating operations. Entities are typically modified with Hibernate by retrieving them from the database, changing specific fields, and persisting the entities.

Monday, June 17, 2024

Top 15 NetBeans Keyboard Shortcuts for Java Programmers

In Java development there are three big IDEs, IntelliJ IDEA, Eclipse and NetBeans. In the past, I have shared Eclipse keyboard shortcuts and IntelliJ IDEA courses and today, I am going to share keyboard shortcuts for NetBeans, one of the first Java IDE I used in my career. I started doing Java development when JCreator was considered great because it can help with function names on objects but when NetBeans comes with features like built-in Tomcat and built-in profiler, it changed the game and I extensively used NetBeans for both web and mobile application development with J2ME. Since then a lot of water have flown in to Java world, InelliJIDEA become the defacto standard IDE for Java development with Eclipse as close second but unlike what many expected, NetBeans didn't die.

Friday, June 14, 2024

Review - Is System Design Interview - An Insider's Guide by Alex Xu and Shan Lam worth?

Hello guys, if you are preparing for System design interviews or Software Design Interviews, then you must have come across System Design Interview - An Insider's Guide by Alex Xu and Shan Lam, one of the most popular book on System Design after Designing Data-Intensive Applications by Martin Kleppmann. I first come across Alex Xu on Twitter when one of his image about how HTTPS works went viral. The image was quite detailed and presentable so I start following Alex and then I come across ByteByteGo, his online System design course and his book System Design Interview - An Insider's Guide

Sunday, June 9, 2024

How to show and hide a div using jQuery? show(), hide(), and toggle() function Example

So, you have a div element and you want to show or hide them may be on a click or during page load, how do you do that in jQuery? Well, jQuery provides convenient show() and hide() methods which can show or hide an element, including div. All you need to do is, write a jQuery selector to find the div you want to show or hide and then call jQuery function show() or hide() depending upon your requirement. You can also use the toggle() function to switch between showing and hiding. This method will make element visible if its hidden and vice-versa. To select the div you can use either element, id or class selector but I recommend to use the ID selector because it will work even if you have multiple div in your page. 

Thursday, June 6, 2024

How to version REST API? URL vs Header Versioning? Example Tutorial

Designing a real world, industry standard RESTful API can be a tricky challenge becuase there is no real standard exists. To add into that, there is also a lot of confusing topics e.g. PUT vs POST for creating and updating resources, or using URL or Header for versioning. There are a lot of advices you will find on internet often confusing and advocating one or other alternative, but it ultimately depends upon your own wisdom and use cases to come up with elegant RESTful URIs, which supports both filtering and versioning. There are both pros and cons of URL versioning and Hypermedia version, which we'll discuss in this article, but the most important lesson to learn is that you should always version your REST API

Sunday, June 2, 2024

Top 20 Spring Boot Interview Questions with Answers for Java Developers

Hello Java developers, there is no doubt that the Spring Boot is now the standard way to develop Java application using Spring Framework, and that's why Spring Boot Questions are increasingly becoming popular on Java interviews. In the past, I have shared many Spring MVC interview questions in this blog like the @RestController vs. @Controller, but I haven't got a chance to share any questions on Spring Boot, Spring Cloud, and Microservices. After a couple of personal requests from my readers, I thought to write about, and here comes my list of top 20 Spring Boot interview questions for Java developers.

Friday, May 31, 2024

Top 50 Free Spring Certification Practice Questions Answers for Java Developers

Hello guys, if you are preparing for Spring Professional certification in 2024 and looking for free Practice questions then you have come to the right place. I have an excellent update to share with you from 5th April 2024 onward, you don't need to complete any mandatory training or Spring Pro courses to become eligible for Spring certification, its free like it was before VMware acquired and now you just need to buy voucher to give this exam.  Earlier, I have shared best spring books and courses and today, I am going to share 50+ spring boot practice questions for this certification. To be honest, preparing for IT certification like Oracle's Java certification or VMware's Spring Certification required a lot of hard-work. I have seen many experienced Java developers failing these certifications and losing money and time due to overconfidence and lack of preparation. 

Difference between Setter vs Constructor Injection in Spring

Spring Setter vs. Constructor Injection
Spring supports two types of dependency Injection, using a setter method, e.g. setXXX(), where XXX is a dependency or via a constructor argument. The first way of dependency injection is known as setter injection while later is known as constructor injection. Both approaches of Injecting dependency on Spring bean has there pros and cons, which we will see in this Spring framework article. The difference between Setter Injection and Constructor Injection in Spring is also a popular Spring framework interview question

Thursday, May 30, 2024

How to sort a HashMap in Java 8 by keys and values using Stream and Lambda Expressions

Technically, you cannot sort a HashMap in Java because it doesn't guarantee any order. So, even if you add entries in sorted order they will be placed randomly and you won't be able to iterate over map in sorted order of keys or values. Though, if you want to process keys, values or entries of an HashMap in sorted order, you can get the data from the HashMap and then potentially use a TreeMap (when you want to sort a HashMap by key) or LinkedHashMap (when you want to sort a HashMap by value) to store entries in sorted order. This is also the way, we used to sort HashMap before Java 8. 

Wednesday, May 29, 2024

3 ways to Find First Non Repeated Character in a String - Java Programming Problem Example

Write a Java program to find the first non-repeated character in a String is a common question on coding tests. Since String is a popular topic in various programming interviews, It's better to prepare well with some well-known questions like reversing String using recursion, or checking if a String is a palindrome or not. This question is also in the same league. Before jumping into the solution, let's first understand this question. You need to write a function, which will accept a String and return first non-repeated character, for example in the world "hello", except 'l' all are non-repeated, but 'h' is the first non-repeated character.

Tuesday, May 28, 2024

Can you take Spring Professional Certification without Training Course? [Yes]

Hello guys, I have a big news to share with you now. Since 5th April 2024, you can take Spring certification without any mandatory training or Spring Pro content. So after a flip flop of making training mandatory, Spring certification is free again. Vmware, the company behind Spring, after acquiring Pivotal has reversed the earlier decision announced on 10th May 2017 by Pivotal, the previous owner of Spring Framework, that "Spring Certification Exams are now available for individual purchase, without enrolling in the course". This was one of the most discouraging changes in the Spring certification program since it's launched 10 years back. The cost of Spring certification was the single, biggest obstacle for many experienced Java and Spring developers to get certified for their Spring framework skills.

Top 25 Apache Kafka Interview Questions Answers for Java Developers

Hello, guys if you are preparing for the Java Developer or Apache Kafka interview and looking for frequently asked Apache Kafka interview questions and answers then you have come to the right place. Earlier, I have shared the best Kafka courses and popular interview questions on JavaJMSSpring Boot, and Hibernate and in this article, I Am going to share 20 frequently asked Apache Kafka interview questions with answers. Over the years, Kafka which is developed by Apache Software Foundation has gained popularity because of its immense capability of data processing and become a standard tool for high-speed and reliable messaging. 

Review - Is Grokking the System Design interview Course on DesignGuru Worth it?

Hello guys,  we are here again today for another exciting topic to discuss. But today, we will not discuss something related to Java or any other language or spring boot. Today, we will discuss something that is immensely practical and has the potential to land you very high-paying jobs. Today we are going to review a course that focuses on System Design! System Design is crucial for coding interviews! And it's also one of the most challenging topics to master. I have shared the best System design courses for coding interviews and books in the past. Today, I will review one of the top system design courses for technical discussions, Grokking the System Design Interview by Design Gurus.

Monday, May 27, 2024

Top 30 Programming questions asked in Interview - Java C C++ Answers

Programming questions are an integral part of any Java or C++ programmer or software analyst interview. No matter which language you have the expertise it’s expected that you are familiar with the fundamentals of programming and can solve problems without taking the help of API. Programming questions like reversing String using recursion or how to find if Array contains duplicates are some popular examples of programming question in Java. Programming questions present a lot of challenges Especially to Java developers as compared to C++ programmer and I think, One reason for this is powerful Java API; Which has a method for almost every need and you rarely need to write by your own or there are lots of third-party library from Apache, Spring, Google and other open sources.

Review - Is ByteByteGo System Design Interview Course by Alex Xu Really Worth it in 2024?

Hello guys, if you are preparing for System Design Interview in 2024 then you may have most likely come across names like ByteByteGo, Alex Xu or System Design Interview - An Insider Guide by Alex Xu, and if you are wondering what they are or you know about them but thinking whether ByteByteGo is worth it or not? then you have come to the right place. Yes, ByteByteGo is indeed worth considering for your System Design Interview preparation. because its created by Alex Xu, an expert with FAANG interview experience, the platform offers in-depth coverage of system design topics. The author's use of diagrams to explain concepts in detail enhances the learning experience. 

Saturday, May 25, 2024

12 Intermediate Database Administrator and Developer Interview Questions on Indexing

A good understanding of Index is very important for any programmer working with database and SQL. It doesn't matter whether you are working as DBA or Application developer, working in Oracle, MySQL, or Microsoft SQL Server or any other database, you must have good understanding of how index works in general. You should know different types of index and their pros and cons, how your database or Query engine chooses indexes and the impact of table scan, index scan, and index seek. You should also be able to build upon your knowledge to optimize your SQL queries as well as troubleshoot a production issue involving long running queries or poor performing queries. This is also a great skill for experience developers with 5 to 6 years of experience under his belt. 

How to Manage Distributed Transaction in Microservices? SAGA and 2 Phase Commit Example Tutorial

Hello guys, managing transaction in a distributed system like Microservices is very challenging and if you don't have a proper approach then you may face production issues and end of with data lose, data corruption and app failure. That's why managing distributed transaction is also an important topic on Microservice interviews. If you are working in Microservices architecture then you may have already heard about the SAGA and 2 Phase Commit etc. and there is also a chance that you may have been asked about those on Java developer interviews. If not, don't worry, in this article, I will tell you about those Microservices design patterns while showing how to manage distributed transactions in Microservices architectures in Java.  

Top 10 Websites to Learn System Design and Software Design in 2024 - Best of Lot

Hello guys, if you are preparing for System design Interview and looking for best resources to master Software design and System design then you have come to the right place. Earlier, I have shred best System Courses, Books, System Design Interview Guide, Cheat Sheets, and System Interview Questions and in this article, I am going to share best places to learn System design in 2024. Before we get to the best websites that will teach you everything you need to know about system design, let me tell you a little bit about what it really is. Systems design is basically the process of defining elements of a system including modules, architecture, components, interface, and data for a system based on a specific set of requirements. It can also refer to the process of defining, developing, and designing systems. These designs have to satisfy the specific needs of a company or an organization.

Friday, May 24, 2024

Top 10 Courses to Learn JavaScript in 2024 - Best of Lot

There is no doubt that JavaScript is the most popular programming language at this moment, and it's also confirmed by StackOverFlow's Survey. You can build static websites, web applications, native mobile applications (yes, you can do that too), desktop applications, and even server-side applications in JavaScript. It also makes you a hundred times more employer as there are tons of web development jobs out there. Because of that, more and more developers are learning JavaScript to become web developers.

Top 10 System Design and Software Analysis and Design Books in 2024 - Best of Lot

Hello guys, System design and Software design are two important topic for coding interviews and also two important skill for Software developers. Without knowing how to design System you cannot create new software and it will also be difficult to learn and understand existing software and system. That's why big technical companies like FAANG pays special attention to System design skill and test candidates thoroughly. If you want to learn System design and looking for best resources like best System design books and courses then you have come to the right place. Earlier, I have shared best System design online courses, as well as Software architecture courses,  and common System design questions and in this article, I am going to share with you best System design books to learn Software design. 

Top 10 Websites and Online Platforms to Learn Git for FREE in 2024 - Best of Lot

Hello guys, like many programmers, I have also worked with a lot of source control systems like SVN, CVS, TFS, VSS, Mercury, and I had always wondered why so many source control systems? Why not just one. It's one of the necessary software tools for development, and everyone needs a version control and code repository, there should be a standard solution. It seems Git and Github have solved that problem now. Now, Git is everywhere from open source to closed source, from small startups to big Investment banks, but there were still legacy projects which were lying on SVN and CVS, but they are now also started moving towards it.

Wednesday, May 22, 2024

Top 8 Online Courses to Learn Docker and Kubernetes in 2024 - Best of Lot [UPDATED]

Hello guys, how are you doing? Are you on track to accomplish your goals this year? I am sure you had made goals when this year was started, but if not, you can still check out 10 Things Java developers can learn in 2024. It's never too late. From my experience with interacting with many software developers, it seems DevOps, Docker, Kubernetes and Cloud Computing is the top priority for many programmers this year, especially senior Java developers. I have been receiving a lot of queries, emails, and chats about how to learn Docker and Kubernetes, two of the most popular DevOps tools. When it comes to learning, nothing beats personal training, but that's not always feasible; hence we need to rely on self-learning using books and online courses, and that's what I will suggest to you in this article.

How to Crack Java Programming Interviews in 2024? Topics, Courses, Books, and Questions

Java Interviews are a little bit different than traditional programming interviews on tech giants and product-based companies like Google, Amazon, Microsoft, or Facebook. First, even though it has questions from Data Structures and Algorithms like String or Array, you can still manage to clear Java interviews if you are not an expert on them. The questions are a little bit easier and more practical than those companies. Another essential thing about Java interviews are questions based upon Java programming language and JDK API. Since Java is also an Object-oriented programming language, you will find lots of OOP questions there.

Tuesday, May 21, 2024

Top 10 System Design Courses for Beginners and Experienced Developers in 2024 - Best of Lot

Hello guys, if you are preparing for System design interview and looking for best online courses to learn essential System design concepts like load balancing, API Gateway, scalability, Microservices architecture as well as learn how to solve popular System design questions like how to design YouTube, WhatsApp, Parking Lot, Library System as well when to use NoSQL and SQL then you have come to the right place.  In the past, I have shared best System Design Books, Free System design courses,  System design prep guide, and System Interview Questions and in this article, I am going to share best System Design Courses for beginners and experienced Software Engineer to level up their System Design skills in 2024. 

Monday, May 20, 2024

100+ System Design Interview Questions and Problems for Software Engineers

Hello guys, if you are preparing for System Design interviews then you may know that you have to prepare for theory questions as well as System design problems where you need to design a real world system like WhatsApp, YouTube or DropBox. Theory questions are mostly based upon System design basics and core concepts like Scalability, Caching, database sharding, load balancer, API gateway, security, proxies, messaging queues and software architecture, particularly Microservices. I have been sharing a lot of system design preparation material from last few years, in for example, in the past, I have shared System Design Interview Prep Guide as well as best System design interview books, courses, cheat sheets, and websites and in this article, I am target to share 100+ System Design Interview questions as well as System Design Problems.

Top 6 Free Data Structure and Algorithm Courses for Java and C Programmers

Data Structure and Algorithm is one of the essential topics for programmers, both to get a job and do well on Job. Good knowledge of data structure and algorithm is the foundation of writing good code. If you are familiar with essential data structures like an array, string, linked list, tree, map, and advanced data structure like Tries, AVL trees, etc and know when to use which data structure and compute the CPU and memory cost of your code in terms  Even though you don't need to write your own array, linked list or hash table, given every major programming SKD provides them like JDK or C++ STL library, you will need to understand them so that you can use them in right place. 

Using the right data structure can drastically improve the performance of an algorithm.