Basics Flashcards

1
Q

What is Java?

A

Java is an OOP language based on C and managed by Oracle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why do we use Java? (Advantages)

A
  1. Java is platform independent (Write Once, Run Anywhere)
  2. It is widely used and grandfathered in
  3. Has a rich API( list of libraries) and documentation
  4. It is open source
  5. Easy to use, strongly typed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the JDK, JRE, & JVM?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an Object?

A

An object is an instance of a class that has state (variables/attributes) and behavior(methods).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a class?

A

A class is a blueprint/template for an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is OOP?

A

Object Oriented Programming is a way to utilize objects to represent our code in the real world

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the pillars of OOP?

A
A PIE
Abstraction
Polymorphism
Inheritance
Encapsulation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Abstraction?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Polymorphism?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Inheritance?

A

Inheritance is the passing of attributes/behaviors from one entity to another. E.g: you get your parents DNA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is encapsulation?

A

Encapsulation is hiding/restricting direct access from users to sensitive information. Created by making methods private, and using getters and setters (accessors and mutators)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the main method?

A

The entry point to our program. It is defined as

public static void main(String[] args){ }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is self documenting code?

A

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”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a primitive data type?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the primitive data type?

A

boolean, int, char, float, double, byte, long

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is flow control?

A

Flow control operators are a series of tools that help us control the ORDER of execution.
Without any flow control tools, the program reads the main method from top to bottom then exits.

17
Q

What are some tools we have available to us for flow control?

A
  • -if, else, else if
    * -switch & case
    * -ternary
    * -while, dowhile, for, foreach/enhanced for loop

branching flow:

	 * -break & continue
	 * -try, catch, finally