Category: Java

  • JUnit: Assert Exceptions

    JUnit: Assert Exceptions

    When writing JUnit, at times you would want to check methods for exceptions. Here’s how you do it. In below method, we divide 2 numbers and throw error if second argument of method is zero. public static double div(double x, double y) { if(y == 0) { throw new ArithmeticException(“divide by zero”); } return (double)(x/y);…

  • Basic JUnit 5

    I have tried learning from various tutorials for JUnit and all tutorials went into unnecessary aspects of JUnit which are useful but not for someone who is looking to grab JUnit understanding quickly and knows Java. So I am writing this tutorial for someone who is looking to grab JUnit concepts and knows Java. Let’s…

  • Building a Robust Backend with Java Spring Boot and MongoDB

    Introduction: Java Spring Boot and MongoDB are two powerful technologies that, when combined, provide a solid foundation for developing scalable and high-performance backend applications. In this article, we will explore the idealistic way of connecting Java Spring Boot with MongoDB, showcasing how these technologies work together seamlessly to deliver a robust and efficient backend solution.…

  • Exploring the Powerful Features of Java 17

    Introduction Java 17 is the latest release of the Java programming language, bringing several exciting features and enhancements. In this article, we will delve into the key features of Java 17 and explore how they enhance developer productivity, performance, and security. 1. Sealed Classes Sealed classes restrict the inheritance hierarchy of a class, allowing you…

  • Exploring the Exciting Features of Java 11

    Introduction Java 11 brought several new features and enhancements to the Java programming language, making it more robust, efficient, and developer-friendly. In this article, we will explore the key features of Java 11 and provide examples to illustrate their usage and benefits. 1. Local-Variable Syntax for Lambda Parameters Java 11 introduced a simplified way to…

  • Exploring the Powerful Features of Java 8

    Introduction Java 8 brought a significant evolution to the Java programming language, introducing several powerful features that enhanced developer productivity and code readability. In this article, we will explore the key features of Java 8 and provide practical examples to help you understand their usage and benefits. 1. Lambda Expressions Lambda expressions introduced a concise…