OOP
Object oriented programming - is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships.
Class - Definition of objects that share structure, properties, and behaviors
Instance - Concrete object, created from a certain class
Write Once Run Anywhere - WORA meaning
Methods - used to descibe behavior of the objects of a class
Methods - is a set of statements which is referred to by name and can be invoked at any point
in a program. it performs a logical unit of work.
Return type - it indicates the data type of the variable returned by a method
Constructors - is a block of code defined in a class that initializs the newly created object
It is stucturally very simila to an instance method, but it doesn't have a return type.
It is automatically called whn the instancee of a class is created.
Types of Constructors
Default Constructors - If a class does not have any constructors
No Argument Constructors - is one that takes no parameters
Parameterized Constructors - a constructor with arguments or parameters
Main principles of OOP
Encapsulation - is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse.
Abstraction - is a process of hiding the implementation details from the user, only the functionality will be provided to the user. In other words, the user will have the information on what the object does instead of how it does
In Java, abstraction is achieved using Abstract classes and interfaces.
Abstract class - is a class that is declared with abstract keyword.
Abstract method - is a method that is declared without an implementation.
Subclass - A method defined abstract must always be redefined in the _______
Inheritance is the process by which one object acquires the properties of another object.
Subclass - A class that is derived from another class
Super class - The class from which the subclass is derived
Polymorphisms - it means the ability to request that the same methods be performed by a wide range of different types of things.
many forms - Polymorphism comes from Greek word
Abstraction and Encapsulation
Members - are the variables and the methods declared in the class
Variable Scope - The member of a class are the variables and the methods declared in the class
This & Super - It refers to the variables and methods of the current class instance.
It can also be used to refer to the constructor of the class
Dot operator - A member method can be invoked by joining the class name and the method signature with a _________
Instance Variables - When a member variable or a field is declared within a class definition, every object instantiated from that class contains its own copy of it
Class Variables - There are also cases when all instances of a class share a variable
Static - Such class variables are defined with the keyword
Instance methods - are methods within Java class definition without the use of the static keyword
Class methods - are methods within Java class definition with the use of the static keyword
Access Modifiers and Accessor Methods
Access Modifiers - used to set the visibility and accessibility of class, methods or variable
Access control - other way to enforce encapsulation
Public, Private, Protected, Default - Ex. Of Access Modifier
Public - can be access by all
Private - can only access within class
Protected - can only accessed by the class, subclass and classes from the same package
Default - no access modifier declared.
