Author: geonikpal

  • Java Interface

    Java Interface

    In this article, we’ll go through what an interface is in Java, why you should use it and when you should use an interface. 1. What Is a Java Interface? An interface in Java is like an abstract class, but it provides full abstraction as you mainly do not implement methods (although since Java 8…

  • Java Constructor

    Java Constructor

    In this article, we’ll go through what a Java constructor is and it works. 1. What Is a Java Constructor? A constructor is a block of code, which might seem similar to methods at first, but has some fundamental differences compared to them. You can utilize a constructor for the creation of a new object.…

  • Java Operators

    Java Operators

    In this tutorial, we will go through all operators that exist in Java and explain when, how, and why you should use them. 1. Java Operators Overview Operators in Java are symbols that are used in combination with variables, in order to perform specific actions. You have used operators many times in your math classes,…

  • How to Install Java on Linux

    How to Install Java on Linux

    Today we will see how to install Java 19.0.2 (this is the last version of Java, as of the time of writing this article) on Linux. Specifically, Ubuntu 20.04.2 LTS Distribution, meaning the Java Development Kit (JDK). 1. Find the Download Link The question “How to install Java on Linux”, is asked by every Java…

  • Access Modifiers in Java

    Access Modifiers in Java

    In this article, we’ll explain what access modifiers are in Java and how they work. 1. What Are Access Modifiers? Access modifiers are keywords that define which classes can access specific classes, members, or methods. The available keywords are: public: This class, member, or method can be accessed from everywhere. protected: The class, member, or…

  • If Statement in Java

    If Statement in Java

    In this article, we will analyze one of the most used commands, the if statement in Java, through detailed examples 1. If, Else If, and Else Statements Syntax The Java if statements are used when we need to do some actions, based on whether a statement is true or false. 1.1 If statement in Java…

  • Java Map

    Java Map

    In this article, we will talk about Java Map Interface which is under java.util package, how it works, and analyze its main implementations. 1. What is a Map in Java You can imagine a Map as a Data Structure which contains Key-Value pairs. This mapping is an Entry of the Map. For example, it could…

  • Java Array

    Java Array

    In this article, we will explain what an array is in Java, how it works, and when it should be used. Every section will include code examples in order to understand the most important aspects of Java arrays. 1. What is a Java Array? An array is a fixed-length object which contains one or more…

  • HashMap in Java

    HashMap in Java

    In this article, we will explain what a HashMap is, analyze the constructors and methods of HashMap class in Java, and then go through a real-world use case of HashMap. 1. What is a HashMap and how it works HashMap in Java is a Key-Value Data Structure. The HashMap class in Java inherits from AbstractMap…

  • Math.random in Java

    Math.random in Java

    1. What is java.lang.Math.random() in java? Today we’ll analyze how the Math.random() method works in Java. The Math.random() method is a function of the Math class that accepts zero arguments and returns a pseudorandom number between 0(inclusive) and 1(exclusive). 2. Simple Math.random() example Below you can find a simple example of using this method: The…