oop unit 7

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/51

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

52 Terms

1
New cards

Platform

Basic hardware + operating system environment where applications run.

2
New cards

Portability (definition)

Ability to run a program on different machines; truly portable means no recompiling or code changes needed.

3
New cards

Why portability matters

Supports more platforms → more potential customers.

4
New cards

Java introduced

Public release by Sun Microsystems in 1995.

5
New cards

Java slogan

“Write Once, Run Anywhere.”

6
New cards

Oracle + Java Sun Microsystems

acquired by Oracle in 2010, bringing Java under Oracle.

7
New cards

Java’s 3 portability types Source code portability;

CPU architecture portability; OS/GUI portability.

8
New cards

Source code portability (C/C++)

C/C++ syntax is defined but semantics are loose → same code may behave differently across CPUs/OS/compilers/settings.

9
New cards

Source code portability (Java)

Java defines more behavior (semantics) than C/C++ → less variation across platforms.

10
New cards

Garbage collection (Java) Memory isn’t freed until

it can no longer be accessed (handled by garbage collector).

11
New cards

Uninitialized variables in Java

Java doesn’t have ANY uninitialized variables.

12
New cards

Java integer size Integers are

32bit

13
New cards

Java floating point standard Uses

IEEE754 floating-point math.

14
New cards

Object code portability

Object code is NOT portable; it’s binary instructions tied to a specific CPU/ISA.

15
New cards

ISA meaning

Instruction Set Architecture; the instruction design a CPU uses.

16
New cards

Why object code is CPU-specific

Binary instructions are tied to a processor’s ISA; code built for CPU type X runs only on type X.

17
New cards

RISC vs CISC

RISC: simple uniform instructions, often fixed length, often 1 clock cycle; CISC: complex instructions, variable length, can do multi-step operations.

18
New cards

JVM (definition)

Software-based virtual machine that runs Java bytecode; abstracts hardware/OS so Java runs on any platform with a compatible JVM.

19
New cards

How JVM enables platform independence

JVM interprets/compiles bytecode into machine-specific instructions at runtime so the same bytecode runs on different platforms.

20
New cards

JVM responsibilities

Manages memory, executes code, handles security and garbage collection.

21
New cards

Key JVM components

Class Loader; Execution Engine; Memory Manager; Bytecode Verifier; JVM ISA (bytecode instruction set).

22
New cards

Class Loader

Loads classes into memory.

23
New cards

Execution Engine

Interprets or compiles bytecode into native machine code.

24
New cards

Memory Manager

Handles heap/stack allocation and garbage collection.

25
New cards

Bytecode Verifier

Ensures bytecode integrity and security.

26
New cards

JVM ISA

JVM has its own abstract platform-independent instruction set (bytecode instructions).

27
New cards

Platform independence slogan

meaning Write once; compile to bytecode; run on any OS/CPU with a JVM.

28
New cards

Java compilation phase 1

Compile .java using javac → produces bytecode (.class).

29
New cards

Java execution phase 2

Run .class using java (JVM interpreter) → translates to native machine code in memory for the target platform.

30
New cards

Is bytecode an executable?

No. Java bytecode is NOT an executable; it requires the JVM to run.

31
New cards

JRE (definition) Java Runtime Environment;

used to run Java programs.

32
New cards

JRE includes

JVM + core Java class libraries (e.g., java.util, java.io).

33
New cards

JDK (definition) Java Development Kit;

used to develop Java applications.

34
New cards

JDK includes

JRE + tools to compile/debug/package Java (e.g., javac).

35
New cards

JDK platform-specific?

Yes; separate installers needed for each OS (Mac/Unix/Windows)

36
New cards

JAR file

A packaged archive for Java apps; can contain multiple files/folders; similar to ZIP with extra distribution features (e.g., signing).

37
New cards

NetBeans JAR location

PROJECT_HOME/dist (created every time you compile).

38
New cards

Production requirement for running a JAR

You should have the JRE installed.

39
New cards

OS/GUI portability challenge

Different OS/GUI APIs for file IO, windows, networking, sound, memory, etc.

40
New cards

Java OS/GUI portability solution

Java libraries provide a virtual OS/GUI (like JVM provides a virtual CPU).

41
New cards

AWT (java.awt)

Thin layer on top of OS; uses native heavyweight components; platform dependent (less portable).

42
New cards

Swing (javax.swing)

Pure Java lightweight components; platform independent (more portable); larger bytecode; richer functionality.

43
New cards

Swing vs AWT portability

Swing is more portable (platform independent); AWT is platform dependent.

44
New cards

Why Swing is in javax

javax originally meant extensions; Swing began as extension; later became standard but kept package name to avoid breaking existing software.

45
New cards

Downside of Java portability

Java assumes 32-bit machine + IEEE754 floats; some machines (e.g., 8-bit microcontrollers) can’t run Java.

46
New cards

C/C++ vs Java portability across devices

C/C++ expected to run on more platforms than Java (especially small/embedded devices).

47
New cards

Java performance criticism

Bytecode execution can be slower than fully compiled native code.

48
New cards

JIT compilation

Just-in-time compilation compiles bytecode into native code, stores it in memory, and reuses it when needed.

49
New cards

HotSpot JVM performance engine

Optimizes frequently used code with a compiler.

50
New cards

Inlining optimization

Replaces method calls with method body to reduce call overhead.

51
New cards

Loop unrolling optimization

Expands loop iterations to reduce loop control overhead.

52
New cards

Dead code elimination

Removes code that will never execute.