PPJ Flashcards
Java Programming Basics
Physical components like processors, memory, storage, and input/output devices.
Hardware
Software that manages hardware and provides services to applications.
Operating System
Tools used to create software instructions.
Programming Language
The smallest unit of data (0 or 1).
Bits
A sequence of 8 bits.
Bytes
A base-16 numbering system used for representing binary data.
Hexadecimal
The central processing unit that executes instructions.
Processor
Basic operations performed by the processor.
Instructions
A sequence of instructions that performs a task.
Program
Translates human-readable code into machine code.
Compiler
Close to machine code (e.g., assembly language).
Low-level
More human-readable (e.g., Python, Java, C++).
High-level
values in the range [−128,127];
byte (1)
values in the range [−32 768,32 767];
short (2)
values in range[0,65 535] interpreted as Unicode code
points of characters (always non-negative);
char(2)
values in the range [−2 147 483 648,2 147 483 647];
int (4)
values in an astronomical range [−9 223 372 036 854 775 808, 9 223 372 036 854 775 807].
long (8)
values in the range [≈1.4·10−45,≈ 3.4·10+38] positive or negative, with roughly 7 significant decimal digits – rarely used;
float (4)
values in the range [≈4.9·10−324 ≈ 1.8·10+308] positive or negative, with roughly 16 significant decimal digits.
double (8)
has only two possible values: true and false.
boolean
Built-in data types for basic values like numbers or characters
Primitive types
User-defined or pre-defined complex data structures.
Object types
are named storage locations in memory that hold specific data types. Only primitive types can be directly assigned names. Object types are accessed through references.
Literals are the actual data values assigned to variables.
Variables
Primitive types are stored on the ___, while objects reside on the ___
stack, heap
automatically manages memory allocation and deallocation for objects
garbage collector
0 1 1 0 1 1 0 0
0 1 0 1 0 1 0 1
6
—————
& 0 1 0 0 0 1 0 0
AND
0 1 1 0 1 1 0 0
0 1 0 1 0 1 0 1
—————
| 0 1 1 1 1 1 0 1
0 1 1 1 1 1 0 1
OR
0 1 1 0 1 1 0 0
0 1 0 1 0 1 0 1
—————
^ 0 0 1 1 1 0 0 1
XOR
~ 0 1 1 0 1 1 0 0 -> 1 0 0 1 0 0 1 1
Negation
- A region of memory used for storing local variables and function call information.
- Follows LIFO (Last-In-First-Out) principle: values are added and removed from the top.
- Automatically managed by the JVM.
- Efficient for accessing and storing data.
- Variables declared within blocks are typically stored on the stack.
Stack
- A region of memory used for dynamically allocated objects.
- Requires manual memory management (allocation and deallocation).
- Slower to access than the stack due to pointer indirection.
- Objects created using new are stored on the heap.
- The garbage collector automatically reclaims unused heap memory.
Heap
- \a – (BEL) alert;
- \b – (BS) backspace;
- \f – (FF) form-feed (new page);
- \n – (LF) new line (linefeed);
- \r – (CR) carriage return;
- \t – (HT) horizontal tab;
- \v – (VT) vertical tab;
- \’ – apostrophe;
- " – quotation mark;
- \– backslash;
double x = 7.7;
int a = (int)x;
Symbols that represent actions to be performed on values (operands).
Operators