• 29 November

    How to Get Variable From Another Class in Java

    In this article, you will learn about accessing a variable from another class in a Java Program. To be able to program in any programming language, it is very critical to be able to understand how to use the variables according to your need, and thus it makes it very important to be able to […]

  • 24 September

    Increment for Loop by 2 in Java

    In this post, we will see how to increment for loop by 2 in Java. There are several looping statements available in Java and one of them is for loop in java. There are three parts of for loop. Initialization Condition Increment or decrement [crayon-6701af56e1d0f196292485/] Initialization: Initialization statement executes at start of loop only one […]

  • 20 September

    Return ArrayList in Java

    This article discusses cases of returning an ArrayList in Java from a method. An ArrayList in Java is a collection of elements of the same data type under a single variable name. In different cases, you can return an ArrayList from a method in Java. These cases are as given below. Returning ArrayList from a […]

  • 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 […]

  • How to print multiple variables in java
    31 January

    How to Print Multiple Variables in Java

    1. Introduction In Java programming, it’s common to need to print multiple variables for various purposes like debugging, logging, or displaying information to the user. These variables might be of different data types (such as integers, strings, or floats), and our goal is to effectively combine and display them. The expected output is a coherent […]

  • What is == in java
    01 December

    What is == in java

    In this tutorial, we will learn what is == in Java as it is a common lexeme that we will use while developing applications. The == lexeme can be confused with = which is another lexeme of the Java language and we will also learn in detail how the two differ to avoid issues such […]

  • Multiple classes in one file in Java
    18 October

    Multiple classes in one file in Java

    In this post, we will see how to have multiple classes in one file in java. Introduction You need to have any number of classes in a single Java file, but there is a restriction that you can declare only one Java class as public modifier with the main() method and declare (without public) for […]

  • Break out of nested loop in java
    22 July

    How to break out of nested loops in Java

    In this post, we will see how to break out of nested loops in Java. Using break (will break inner loop) It is very important to understand how nested loops work to ensure that applying break will output the desired result. If you are a novice with nested loops, I am going to make the […]

  • public static void main(String args[]) - Java main method
    11 June

    public static void main(String[] args) – Java main method

    If you have worked with Java programs before, you know that all Java programs start by running the main() method(public static void main(String[] args)). The main() method is the entry point. The signature of the main method is fixed, and each portion of the statement has significance. Why is the main method so important? The […]