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.