A class that represents an immutable universally unique identifier (UUID). A UUID represents a 128-bit value. There exist different variants of these global identifiers.
Continue reading UUID class in javaJava
Scanner is a class in java.util package used for obtaining the input of the primitive types like int, double, etc. and strings. It is the easiest way to read input in a Java program, To create an object of Scanner class, we usually pass the predefined object System.in, which represents the standard input stream. We …
Continue reading Scanner Class in JavaThe Java Math class provides more advanced mathematical calculations than what the basic Java math operators provide. The Math class contains methods for finding the maximum or minimum of two values, rounding values, logarithmic functions, square root, and trigonometric functions (sin, cos, tan etc.). The Math is located in the java.lang package, and not in the java.math package. Thus, the fully qualified class name of …
Continue reading Math Class in javaWhen JVM starts up, it creates a heap area which is known as runtime data area. This is where all the objects (instances of class) are stored. Since this area is limited, it is required to manage this area efficiently by removing the objects that are no longer in use. The process of removing unused …
Continue reading Garbage Collection in Javafinal keyword can be used along with variables, methods and classes. 1) final variable final variables are nothing but constants. We cannot change the value of a final variable once it is initialized. Lets have a look at the below code: Note: It is considered as a good practice to have constant names in UPPER …
Continue reading Final Keyword In JavaYou must have seen public, private and protected keywords while practising java programs, these are called access modifiers. An access modifier restricts the access of a class, constructor, data member and method in another class. In java we have four access modifiers: 1. default 2. private 3. protected 4. public 1. Default access modifier When …
Continue reading Java Access ModifiersEncapsulation simply means binding object state(fields) and behaviour(methods) together. If you are creating class, you are doing encapsulation. What is encapsulation? The whole idea behind encapsulation is to hide the implementation details from users. If a data member is private it means it can only be accessed within the same class. No outside class can …
Continue reading Encapsulation in JavaA class that is declared using “abstract” keyword is known as abstract class. It can have abstract methods(methods without body) as well as concrete methods (regular methods with body). A normal class(non-abstract class) cannot have abstract methods. An abstract class can not be instantiated, which means you are not allowed to create an object of …
Continue reading Abstract Class in JavaPolymorphism is one of the OOPs feature that allows us to perform a single action in different ways. For example, lets say we have a class Animal that has a method sound(). Since this is a generic class so we can’t give it a implementation like: Roar, Meow, Oink etc. We had to give a …
Continue reading Polymorphism in JavaThe process by which one class acquires the properties(data members) and functionalities(methods) of another class is called inheritance. The aim of inheritance is to provide the reusability of code so that a class has to write only the unique features and rest of the common properties and functionalities can be extended from the another class. …
Continue reading Inheritance in Java