Polymorphism: Polymorphism is a Java concept that allows us to perform a single action in multiple ways. Polymorphism is made up of two Greek words: polymorphism and morphism. The words “poly” and “morphs” both mean “many.” Polymorphism denotes the presence of multiple forms. Types of polymorphism: compile-time polymorphism runtime polymorphism. Polymorphism in Java is achieved […]
May 25, 2022 | Java | No comments
In Java, method overriding occurs when a subclass (child class) has the same method as the parent class. Overriding is a feature that allows a subclass or child class to implement a method that is already provided by one of its super-classes or parent classes. When a subclass’s method has the same name, parameters, signature, […]
May 21, 2022 | Java | No comments
Method Overloading in Java: Method Overloading occurs when a class has multiple methods with the same name but different parameters. Compile-time (or static) polymorphism is linked to overloading. The readability of the program is improved by method overloading. We don’t have to develop new names for functions that do the same thing. Overloading the method […]
May 21, 2022 | Java | No comments
Association: Association is a relation between two separate classes which establishes through their Objects. One-to-one, one-to-many, many-to-one, and many-to-many associations are all possible. An Object communicates with another object to use its functionality and services in Object-Oriented programming. Composition and Aggregation are the two forms of association. Composition: The strongest type of association is composition. It represents part-of relationship. If […]
May 21, 2022 | Java | No comments
In Java, inheritance is a mechanism by which one object inherits all of its parent’s properties and behaviors. It is an essential component of OOPs (Object-Oriented programming systems). You can use the parent class’s methods and fields when you inherit from an existing class. You can also add new methods and fields to your current […]
May 19, 2022 | Java | No comments
Non-access modifiers provide the JVM with information about a class, method, or variable’s characteristics. In Java, there are seven different types of Non-Access modifiers: static final abstract synchronized volatile transient native Static: The static keyword indicates that the entity to which it is applied is accessible from any instance of the class. The static keyword […]
May 17, 2022 | Java | No comments
Modifiers in Java are divided into two categories: access modifiers and non-access modifiers. The accessibility or scope of a field, method, constructor, or class is defined by the access modifiers in Java. The access modifier can be used to change the access level of fields, constructors, methods, and classes. Types of access modifiers: There are […]
May 14, 2022 | Java | No comments
Let us take a look at various other constructors in Java. Copy constructor: A copy constructor is a type of constructor in Java that creates an object by copying another object from the same Java class. It returns a copy of a class object that already exists. If we want to, we can use the copy constructor: Make […]
May 14, 2022 | Java | No comments
Java constructors or constructors in Java are terminologies used to construct something in our programs. A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes. At least one constructor is called […]
May 13, 2022 | Java | No comments
A method is a block of code, a group of statements, or a set of code that performs a specific task or operation. These are also known as functions in other programming languages. The method describes the behavior of an object. It increases code reusability. It also provides an easy modification of the code. Method Declaration: […]
May 12, 2022 | Java | No comments