• Check if Object is null Java
    14 March

    Check if Object Is Null in Java

    1. Introduction to the Problem Statement In Java programming, handling null references is essential for preventing the dreaded NullPointerException. Suppose we have an object, MyObject. Our objective is to determine whether MyObject is null. The expected output is a boolean value indicating the null status of the object. This article explores several methods for checking […]

  • Java random number between 1 and 100
    07 March

    Random Number Between 1 and 100 in Java

    TL;DR To generate random number between 1 and 100 in java, you can use Math.random() method. [crayon-6a1ea000c1d96468283446/] Output: Random number between 1 and 100: 26 Math.random Java between 1 and 100 Java provides the Math class to perform all sorts of mathematical operations. The class also has a method named random() that produces pseudo-random numbers […]