Dcit50 Reviewer
Dcit50 Reviewer
POLYMORPHISM MAINTAINABILITY
The term "polymorphism" means "many Teams can work more effectively together
forms". In object-oriented programming, when they follow common conventions.
polymorphism is useful when you want to
create multiple forms with the same name AVOIDING AMBIGUITY
of a single entity. To implement Clear, descriptive names reduce confusion
polymorphism in Java, we use two about what a class, method, or variable
concepts method overloading and method does
overriding.
METHOD OVERLOADING - is INDUSTRY STANDARDS
performed in the same class where we Following widely accepted conventions
have multiple methods with the same ensures that your code can be easily
name but different parameters understood by other developers familiar
METHOD OVERRIDING - is performed with Java.
by using the inheritance where we can
have multiple methods with the same OBJECT AND CLASSES IN JAVA
name in parent and child classes.
CLASSES AND OBJECTS
ADVANTAGES OF OOP OVER are basic concepts of Object Oriented
PROCEDURE-ORIENTED PROGRAMMING Programming (OOPs) that are used to
LANGUAGE represent real-world concepts and entities.
The implementations of OOPs concepts are The class represents a group of objects
easier. having similar properties and behavior.
The execution of the OOPs is faster than
procedural-oriented programming. JAVA CLASSES
A class in Java is a set of objects which PUBLIC - Accessible from any other
shares common characteristics/ behavior class.
and common properties/ attributes. It is a PRIVATE - Accessible only within the
user-defined blueprint or prototype from same class
which objects are created. PROTECTED - Accessible within the
same package or subclasses.
PROPERTIES OF JAVA CLASSES
A class does not take any byte of memory. class <class_name>
A class is just like a real-world entity, but it - is the name you give to the class, which
is not a real-world entity. It's a blueprint should start with a capital letter as per Java
where we specify the functionalities. naming conventions.
A class contains mainly two things:
Methods and Data Members. data member
A class can also be a nested class. - These are variables declared inside the
Classes follow all of the rules of OOPs such class that represent the attributes or
as inheritance, encapsulation, abstraction, properties of the objects created from the
etc. class.
PARAMETERIZED CONSTRUCTOR
A Java constructor can also accept one or
more parameters. Such constructors are
known as parameterized constructors
(constructors with parameters).
Takeaways:
It accepts arguments (or parameters) to
initialize an object's instance variables. JAVA COPY CONSTRUCTOR
It allows you to initialize an object with Copy constructor is a special type of
specific values, making the object more constructor that creates a new object as a
flexible and dynamic. copy of an existing object. The copy
You can have multiple parameterized constructor takes an object of the same
constructors in the same class (this is class as a parameter and duplicates its field
called constructor overloading) as long values into the new object. Java doesn’t
as each has a unique set of parameters. provide a built-in copy constructor like some
other programming languages (e.g., C++),
CONSTRUCTOR OVERLOADING but you can manually define one in your
Constructor overloading in Java is a feature class.
that allows a class to have more than one
constructor, each with a different parameter
list (number or type of parameters). It
enables objects to be created in multiple
ways by providing different sets of data at
the time of object creation.