40 lines
1.8 KiB
Markdown
40 lines
1.8 KiB
Markdown
- #[[CT2106 - Object-Oriented Programming]]
|
|
- No previous topic
|
|
- **Next Topic:** [[Introduction to Java]]
|
|
- **Relevant Slides:** 
|
|
-
|
|
- ## Definitions
|
|
- What is a **class**? #card
|
|
card-last-interval:: 23.43
|
|
card-repeats:: 4
|
|
card-ease-factor:: 2.42
|
|
card-next-schedule:: 2022-12-02T22:44:35.056Z
|
|
card-last-reviewed:: 2022-11-09T12:44:35.056Z
|
|
card-last-score:: 3
|
|
- A **class** is a type of *blueprint* or *template* from which you make objects.
|
|
- What is an **object**? #card
|
|
card-last-interval:: 27.13
|
|
card-repeats:: 4
|
|
card-ease-factor:: 2.56
|
|
card-next-schedule:: 2022-12-11T23:00:56.373Z
|
|
card-last-reviewed:: 2022-11-14T20:00:56.374Z
|
|
card-last-score:: 5
|
|
- A (Java) **object** is a self-contained component which consists of *methods* and *properties*.
|
|
- It is a piece of code that has a **state** and has **behaviour**.
|
|
- Often, they represent a "real-life" object.
|
|
- An object is created by *instantiating* a **class**.
|
|
- What is **bytecode**? #card
|
|
card-last-interval:: 29.26
|
|
card-repeats:: 4
|
|
card-ease-factor:: 2.66
|
|
card-next-schedule:: 2022-12-13T22:39:29.786Z
|
|
card-last-reviewed:: 2022-11-14T16:39:29.787Z
|
|
card-last-score:: 5
|
|
- Unlike other high-level programming languages, Java code is **not** compiled into machine-specific code that can be executed by a microprocessor.
|
|
- Instead, Java programs are compiled into **bytecode**. The bytecode is input into a **Java Virtual Machine (JVM)**, which interprets & executes the code. The JVM is usually a program itself.
|
|
- Bytecode is **platform independent**.
|
|
- The JVM is specific for each platform, but the bytecode for the program remains the same across different platforms.
|
|
- The main trade-off is the effect it has on the execution speed.
|
|
-
|
|
-
|
|
- |