click below
click below
Normal Size Small Size show me how
mis3370 final review
| Term | Definition |
|---|---|
| char | holds a single character value and is a primitive data type that can be compared using operational operators like $\text{==}$ |
| String | a class that holds a memory address (reference) for working with fixed |
| equals() | compares two $\text{String}$ objects for content equality in a case |
| equalsIgnoreCase() | compares two $\text{String}$ objects for content equality in a case |
| compareTo() | compares $\text{String}$ objects alphabetically; returns $\text{0}$ if equal, a negative number if the calling $\text{String}$ comes first, and a positive number if it comes after |
| Strings are immutable | once a $\text{String}$ object is created, its value cannot be changed |
| .length() | returns the number of characters (the length) in a $\text{String}$ |
| .substring(start, end) | extracts part of a string; $\text{startIndex}$ is inclusive, and $\text{endIndex}$ is exclusive |
| .toUpperCase()/.toLowerCase() | $\text{String}$ methods that return a new string with all characters converted to the specified case |
| .charAt(index) | returns the single $\text{char}$ value at the specified zero |
| .indexOf() | returns the index of the first occurrence of a specified character or substring, or $\text{ |
| .trim() | returns a new string with leading and trailing whitespace removed |
| .replace() | returns a new string by replacing all occurrences of a specified character with another character |
| Accessing string methods within arrays | access the specific $\text{String}$ element first, then call the method (e.g., $\text{names[i].length()}$) |
| String indexing | starts at 0 for the first character |
| Array | a named list of data items (elements) of the same type |
| .length | an array attribute that returns the array size (number of elements) |
| Array index | starts at 0 for the first element |
| Subscript | the integer contained within square brackets ($\text{[ ]}$) used to identify an array's specific element |
| Passing a single array element to a method | uses pass by value (a copy of the value is used) |
| Passing an entire array to a method | uses pass by reference (the memory address is passed, allowing the receiving method to alter original array elements) |
| Parallel array | two or more arrays that have the same number of elements, where values at the same index position correspond to each other (e.g., $\text{names[i]}$ corresponds to $\text{grades[i]}$) |
| Default value for $\text{int[]}$ | elements are automatically initialized to $\text{0}$ |
| Default value for $\text{char[]}$ | elements are automatically initialized to $\text{\\u0000}$ (null character) |
| Default value for $\text{boolean[]}$ | elements are automatically initialized to $\text{false}$ |
| Default value for $\text{String[]}$ and Object arrays | elements are automatically initialized to $\text{null}$ |
| Inheritance | allows one class to inherit attributes and behaviors from another class |
| Superclass (Parent | |
| Base Class) | the class being inherited from |
| Subclass (Child/Derived Class) | the class that inherits from the base class and can add its own members, created using the keyword $\text{extends}$ |
| super() | a call used as the first statement within a subclass constructor to execute the corresponding superclass constructor |
| Subclass constructor execution order | $\text{Superclass}$ constructors run before $\text{Subclass}$ constructors |
| @Override | an annotation used to indicate that a subclass method provides specialized behavior for a method inherited from the superclass |
| Cannot override | $\text{static}$, $\text{private}$, or $\text{final}$ methods |
| private | accessible only within the same class |
| protected | accessible by the class itself and all subclasses, but not outside the package |
| public | accessible everywhere (class, subclass, outside package) |
| Getters and Setters | $\text{public}$ methods used to access ($\text{get}$) and modify ($\text{set}$) $\text{private}$ fields (information hiding) |
| File Class | primary purpose is to deal with the file system (check existence, create, delete, retrieve path/name), not to handle reading or writing of data |
| Opening a file | creating a file stream to link the program to the physical file on disk |
| Closing a file | calling the $\text{.close()}$ method on the stream object, which is crucial to prevent data corruption or loss |
| Stream | an abstract, continuous, sequential flow of data |
| Output stream | data flows out of your program to a destination (e.g., $\text{PrintStream}$) |
| Input stream | data flows in to your program from a destination |
| DataInputStream | a class with methods designed to read single, specific data values (fields) from a binary stream |
| readUTF() | $\text{DataInputStream}$ method that first reads two bytes (specifying $\text{String}$ length), then reads the specified number of bytes for the characters |
| readInt() | $\text{DataInputStream}$ method that reads four bytes from the input stream and interprets them as an $\text{int}$ |
| Sequential access file | records are processed in the order they were written (like a cassette tape) |
| Random access file | records can be accessed directly and immediately without reading preceding records (like a digital playlist) |
| Key | a field within a record used to uniquely identify that record for searching and sorting (e.g., employee ID) |
| $\text{\\n}$ | an escape symbol representing a newline character |
| $\text{\\t}$ | an escape symbol representing a tab character |
| $\text{\\\\}$ | an escape symbol representing an actual backslash character |
| JVM (Java Virtual Machine) | an interpreter that executes bytecode and makes Java platform |
| JDK (Java Development Kit) | the complete set of tools, including the compiler and $\text{JVM}$, required to write and run Java programs |
| Bytecode | the intermediate code produced by the Java compiler from source code, which the $\text{JVM}$ interprets |
| Polymorphism | using the same method name to achieve different results or interpretations based on the object or parameters |
| Encapsulation | the practice of enclosing and concealing data (attributes) and methods within a class, often controlled by access modifiers |
| Inheritance | the ability to create new classes (subclasses) that share attributes and methods of existing classes (superclasses) |
| GUI (Graphical User Interface) | a visual interface for a program, often created using specific text commands like $\text{JOptionPane}$ |
| public | an access modifier meaning a class member can be accessed from anywhere in the program |
| private | an access modifier meaning a class member can only be accessed from within that class |
| Syntax | the rules for correctly combining language elements to produce usable program statements |
| Syntax error | a misuse of the language rules (e.g., misspelling a keyword, missing a semicolon) resulting in a failed compilation |
| Class | a blueprint for creating objects with common properties and methods |
| Attribute (Class | Level Variable) |
| Local variable | a variable declared inside a method (or block), visible and usable only within that specific scope, and destroyed when the method finishes |
| Object | a specific instance of a class |
| Method | a block of program code that carries out some action |
| Method signature | the combination of the method name and its parameter list, which must be unique within a class |
| main method | the required starting point for every standalone Java application ($\text{public static void main(String[] args)}$) |
| static keyword | indicates a method or variable belongs to the class as a whole and can be used without creating an object of that class |
| Debugging | the process of freeing a program of bugs (flaws or errors) |
| Constant | a variable whose value never changes, declared using the $\text{final}$ keyword |
| Concatenated | combining two or more values (often strings) end |
| Pre-increment ($\text{++x}$) | an operator that means "update (increment), then use" the variable's value in the expression |
| Post-increment ($\text{x++}$) | an operator that means "use, then update (increment)" the variable's value |
| Implicit casting (Type Conversion) | when Java automatically converts a value from a smaller data type to a larger data type (e.g., $\text{int}$ to $\text{double}$) |
| Explicit casting (Type Conversion) | when you manually convert a value from a larger data type to a smaller data type, often resulting in data loss (e.g., $\text{int i = (int) 3.6;}$) |
| Primitive type | a simple, fundamental data type that holds the actual data value (e.g., $\text{byte}$, $\text{int}$, $\text{char}$, $\text{boolean}$) |
| Reference type | a complex data type that holds a memory address (reference) to an object (e.g., $\text{String}$, arrays, custom classes) |
| $\text{\\n}$ | an escape character that represents a new line |
| $\text{\\t}$ | an escape character that represents a tab space |
| Truncated | the process where the decimal part of a number is completely dropped during explicit casting to an integer type |
| $\text{JOptionPane}$ | a Java class used to create dialog boxes (GUIs) for simple input or message display |
| showInputDialog() | a $\text{JOptionPane}$ method that prompts the user for text input and returns the response as a $\text{String}$ |
| ConfirmDialog | a $\text{JOptionPane}$ method that asks a question and provides buttons like Yes, No, and Cancel |
| Relational operators | symbols used to test the relationship between two items (e.g., $\text{==}$, $\text{>}$, $\text{!=}$) |
| Scope | the area where a variable is usable (e.g., local, class |
| Constructor | a special type of method that is called automatically when an object is created, used to initialize the object's attributes; it has the exact same name as the class and no return type |
| Implementation hiding | the principle that the user/caller of a method needs to understand only the method's interface (how to call it), not the complex details of how it works |
| Method Return Type | defines the type of value a method sends back to the calling method (e.g., $\text{int}$, $\text{String}$, or $\text{void}$ if nothing is returned) |
| return statement | the command that causes a value to be sent from the called method back to the calling method |
| Instantiation | the process of creating a specific object from a class blueprint (e.g., $\text{ClassName objectName = new ClassName();}$) |
| Block | any code contained within a pair of curly braces $\text{\{ \}}$ |
| Overloading | having two or more methods in the same class with the same name but different parameters (different method signatures) |
| Overriding | when a subclass provides its own specific implementation of a method that is already defined in its parent class (must have the same name and parameters) |
| this() | used within a constructor as the very first line to call another constructor in the same class |
| this.name | used in assignment to refer to the current object's attribute when a local variable has the same name |
| Passing by Reference (for Objects) | passing a copy of the memory address of an object to a method, meaning changes made inside the method affect the original object |
| if statement | a control structure that runs the following block of code only if the condition is true |
| else if | a follow |
| else | the catch |
| switch statement | allows a variable to be tested for equality against multiple case statements, offering a cleaner alternative to a long $\text{if |
| break statement (in switch) | prevents fall |
| Logical AND ($\text{\&\&}$) | an operator where both sides must be true for the entire expression to be true |
| Logical OR ($\text{\vert\vert}$) | an operator where only one side must be true for the entire expression to be true |
| Short | Circuiting |
| The NOT operator ($\text{!}$) | inverts a boolean value (e.g., $\text{!true}$ becomes $\text{false}$) |
| The Conditional Operator ($\text{? :}$) | a shorthand for an $\text{if |
| Pseudocode | a planning tool that uses plain English statements to lay out a program's logic |
| Flowchart | a planning tool that uses diagrams and symbols to show the steps and flow of a program's logic |
| for loop | a loop best used when a definite number of iterations is required |
| while loop | a loop that executes its body continually as long as its condition is true; the condition is checked at the beginning |
| do | while loop |
| Loop Control Variable | the variable used in a loop's condition to govern whether the loop continues to execute |
| Nested loop | a loop placed inside the body of another loop |
| Infinite loop | a loop whose condition never becomes false, causing it to run forever |
| Semicolon Placement (loop error) | a misplaced semicolon after a loop's condition (e.g., $\text{for (int i=0; i<5; i++);}$) will terminate the loop immediately without executing the body |
| Loop Fusion | a compiler optimization that combines two adjacent loops into a single loop to improve performance |