SkillStorm
stacks
Stacks are last-in, first-out data structures Ex: undoing an action
Hierarchical inheritance
a parent class is inherited by many subclasses Class A ---> Class B ---> Class C
What is an Object?
an instance of a class real world entity has properties performs tasks
ArrayList Example
ArrayList<integer> myList = new ArrayList<>() ArrayList<Cat> myList = new ArrayList<cat>(25)
What is OOP?
Bottom up Objects & Classes Access modifiers More secure Supports overloading Ex; Python & Java
HashMap
provides a way to create key-value pairs. The key is used to lookup the value at constant time.
Multi level inheritance
where one can inherit from a derived classes Class A & Class B ----> Class C
single inheritance
Inheritance type where only one superclass exists. Class A ---> Class B
Hub
Physical Layer) (Multiport Repeater)(Active, Passive, intelligent)
Example of inheritance
Product Pid Name Price iphone extends Product Brand Tech Mobile extends product Ram Os Sd
example of polymorphism
Program that is executing an add function, can be Add(), Add(int a,int b)
Abstraction
"shows" only essential attributes and "hides" unnecessary information Enables multiple inheritance
Router
(similar to a switch, routes data packets based on IP address)
Polymorphism (MOMO)
Same Method performed in different ways method overloading Method Overriding
Example of an object & class?
A Human is an object, & student would be a class. A human would have tasks & the student class would have specific tasks
What is a class?
A blueprint that defines an objects variables and methods.
Switch
(Multiport bridge with a buffer)
Repeater
(Physical layer) (Regenerate signal)
Bridge
(data link) (A repeater but filters content on Mac address)(transparent, source)
Inheritance
Acquiring the properties of one class to another class. Child class inherits the Parents class properties Reusing Code
Encapsulation (G&S)
Binding variables and methods under single entity. Getters and setters are used to protect your data when creating classes.
Example of Abstraction
Download Android apps as .apk so we run .exe but we don't get the code that runs this function. So no methods
Name the 4 Pillars of OOP
Encapsulation Inheritance Abstraction Polymorphism
Arrays
Fixed length & cannot be changed Primitive data types and objects Does not insert, just assigns.
Array Example
Int[] myArray = new int[10] Int[] myArray = new int{1,2,3,4,5,6,7,8,9,10} Dog[] dogs = new Dog[25]
What is the format for writing an object?
Public Class Main{ public static void main(String[] args) Main myObj = new Main(); or p1 = MyClass() print(p1)
Queues
Queues are first-in, first-out Favors ordered data
Example of encapsulation
Setting the variables as private & using the Getter/Setter methods to place/extract the data. Data hiding & Reusing code.
What do the method of Getters and Setters do?
The getter method returns the value of the attribute. The setter method sets a parameter and assigns it to the attribute
Class can not communicate with each other so Objects are used. T/F?
True
Array List
Variable length & will automatically change as data does. Objects and generic data types(not primitive). Adds to tailend of array.
method overloading
When two methods have the same name, but different parameters. Favors Compile Time
Method Overriding
child class overwritting a method inherited from a parent class. Favors Run Time
Gateways
connect two networks together)
LinkedList
similar to ArrayList (index position), except that the elements are doubly linked to one another. So this linkage gives new methods for adding and removing from the beginning or end, which makes it an easy choice for implementing a stack or queue.