Author name: javaplanet.io

Composition,Inheritance and Deligation

In Java, Composition, Inheritance, and Delegation are three fundamental concepts used in object-oriented programming, each serving distinct purposes in structuring classes and their relationships. Composition Composition involves creating complex objects by combining simpler ones, forming a “has-a” relationship. In Java, this is achieved by including an instance of another class within a class. For example, …

Composition,Inheritance and Deligation Read More »

Access Specifiers

Access specifiers in Java are keywords that define the visibility or accessibility of classes, methods, and fields within a Java program. There are four access specifiers in Java: public, private, protected, and default (package-private). Public The public access specifier allows unrestricted access to the associated class, method, or field. It can be accessed from any …

Access Specifiers Read More »

Programs on Polymorphism

Concurrent collections are specialized data structures in programming that facilitate safe and efficient manipulation of shared data by multiple threads in a concurrent environment. Traditional collections, like lists, queues, or maps, often face issues like race conditions when accessed by multiple threads simultaneously. Concurrent collections address these issues by providing built-in thread-safe operations. Concurrent collections …

Programs on Polymorphism Read More »

Method Overloading

Method overloading in Java is a powerful feature that allows a class to have multiple methods with the same name but different parameters within the same class. This provides flexibility and enhances code readability. The main advantages of method overloading in Java are as follows Readability and Simplicity:Method overloading makes code more readable and simpler …

Method Overloading Read More »

Introduction

Object-Oriented Programming (OOP) is a fundamental paradigm in the world of software development. It’s a programming approach that revolves around the concept of “objects” and provides a structured way to model real-world entities, their behaviours, and their interactions within a computer program. This introduction will delve into the core principles and concepts of OOP, providing …

Introduction Read More »

this keyword

In Java, the this keyword is a reference variable that is used to refer to the current object within a method or constructor. It is particularly useful in situations where instance variables and parameters have the same names, helping to distinguish between the two and avoid naming conflicts. Key Uses of the this Keyword Distinguishing …

this keyword Read More »

Constructors

Constructors in Java are special methods within a class that are used to initialize objects of that class. They have the same name as the class and do not have a return type, not even void. Constructors are automatically invoked when an object is created using the new keyword. Key Points about Constructors Name and …

Constructors Read More »

Scroll to Top