As we know that an abstract class can have constructors, data members, and non-abstract methods as well. This chapter will shows, how we can declare and use the Constructors in the abstract class. Important Features of Abstract Class and Methods Abstract Class An abstract class would be declared using the ‘abstract’ keyword. The creation ofRead More
Class
Parameterized Constructors v/s Setter and Getter function in JAVA.
In my opinion, there is only a syntax difference between parameterized constructors and setter function in JAVA. Both would be used to initialize the class variables with user-defined values. In parameterized constructors, all the class variables can be initialized within one function (constructor) which is automatically invoked when a user creates an object of thatRead More
Using HashMap in Java. (Collection-4)
HashMap is a class that implements the Map interface. A map stores data in the Key-Value pair. HashMap uses the same technique to store values. Class: HashMap Interface: Map Package: java.util We can never lose any data as we are tagging each element with a key in HashMap. On the other hand, while using anRead More
LinkedList Class implementation and usage. (Collection-3)
In LinkedList objects are stored as a node in a List. Each node is divided in three parts: Address of Previous node, Data of the node, Address of Next node. Review features of ArrayList It is a resizable array which increases the array size whenever we add new items in the list. The default sizeRead More
Use of ArrayList Class in Java. (Collection-2)
ArrayList Class implements List Interface. In the last chapter, we have read about all the classes and their features as well as limitations. Now, we will understand all these concepts at the code level. Class: ArrayList Interface: List Package: java.util Key points of ArrayList Stores objects as a list of elements and Any number of elements canRead More
Basic Java – 15 || Runtime User Input using Scanner Class (Part-1).
Scanner Class is the commonly used way of taking user inputs. There are many instances where user interaction is needed at runtime during the Program execution. Scanner Class It can be used via java.util.Scanner library files. There is a major role of Whitespace and Enter while taking user inputs using Scanner class. These user inputsRead More
Basic Java – 7 || Static Variables and Methods.
The synonyms of static, is unchangeable or fixed, means value doesn’t get change from external behaviors. In Java, static variables and methods can be called directly using the class name without creating any object. In other words, the static keyword used to define a method orRead More
Basic Java – 6 || Understanding of Constructor and Destructor in JAVA.
The basic meaning of Constructor is making or building something and Destructor means destroying or releasing something. So, technically, Constructor allocates memory to the variables for specific instance which have been created at any point in time. On the other hand, Destructor deallocates memory or releases the memory afterRead More
Basic Java – 4 || More on methods(Return Type and Parameters)
There are two main key functions for methods. Parameters and Return Type. If we talk about Parameters, these are the inputs for the methods. On the basis of these inputs methods performs any action. Once all the steps get executed mentioned within the block of a method, the output ofRead More
Basic Java – 3 || Understanding Class, Objects, Methods in Java.
A Class is like a repository which contains all data members and methods. On the other hand, an Object is an instance of a class which acquires all the properties(data members) and behavior(methods) of the class. Related Links: OOPs Concept: Java Question And Answer: Method Read More