Basics Flashcards
What is Java?
Java is an OOP language based on C and managed by Oracle.
Why do we use Java? (Advantages)
- Java is platform independent (Write Once, Run Anywhere)
- It is widely used and grandfathered in
- Has a rich API( list of libraries) and documentation
- It is open source
- Easy to use, strongly typed
What is the JDK, JRE, & JVM?
Java Development Kit(JDK): It is a tool used by developers to write source code, and it includes the JRE, JVM, debugger, devtools, e.t.c
Java Runtime Environment (JRE): is the collections of libraries required to help our program function/to run our java code. It contains the JVM.
Java Virtual Machine(JVM): it acts as an interpreter translating your java files into something your OS can understand.
What is an Object?
An object is an instance of a class that has state (variables/attributes) and behavior(methods).
What is a class?
A class is a blueprint/template for an object.
What is OOP?
Object Oriented Programming is a way to utilize objects to represent our code in the real world
What are the pillars of OOP?
A PIE Abstraction Polymorphism Inheritance Encapsulation
What is Abstraction?
Abstraction is a technique used to hide HOW a thing works, but just showing WHAT it does. E.g: We know a remote changes the channel we just don’t care about how it works.
What is Polymorphism?
Polymorphism is the ability of an entity to act/behave differently depending on the scenario/stimuli. E.g: water can act differently depending on the temp or container
What is Inheritance?
Inheritance is the passing of attributes/behaviors from one entity to another. E.g: you get your parents DNA
What is encapsulation?
Encapsulation is hiding/restricting direct access from users to sensitive information. Created by making methods private, and using getters and setters (accessors and mutators)
What is the main method?
The entry point to our program. It is defined as
public static void main(String[] args){ }
What is self documenting code?
Self document code is code that describes what it does via its own name. For example, naming your variables
something like “numOfInstances” instead of “x”
What is a primitive data type?
It is a value that is not a referenced type. We don’t create new instances in the heap and they are stored on the call stack.
What are the primitive data type?
boolean, int, char, float, double, byte, long