Java 1 Flashcards
Object orientation
An approach that supports the creation, enhancement and maintenance of complex IT systems
Method
An element of objects that is used to create, read, change and perform calculations on the values of attributes
Class
A structure that is used to create digital objects which are the central elements in the OO software development process
Analysis model
The result of the OO analysis, which is used for communication between developers and client and/or users of system
Complier
A software that translates a program code into a form that can be executed by a computer
Bytecode
The form of Java program after its compilation that can be executed with JRE
Default value
A value that is assigned to an attribute automatically when the object is created
Principle of data encapsulation
An object can never directly access attributes of another object or changing them. It is possible only by getters and setters
Method signature
Method name + parameters list. RETURN TYPE IS NOT A PART OF METHOD SIGNATURE
Method overloading
This process is sued too implement multiple methods with same name and different parameters list
Syntax error
Error in code construction
Runtime error
Error that causes a program to terminate abnormally
Logic error
Error that occurs when a program does not perform the way it was intended to
Pseudocode
Natural language mixed with some programming code
Variable
Value which is stored in computer memory
Data type
The kind of data that is stored in a variable
Specific import
Import that specifies a single class
Wildcard import
Import all classes from a package
Scope of variable
Is the part of the program where the variable can be referenced
Named constant
Is an identifier that represents a permanent value
Literal
Is a constant value that appears directly in a program
Casting
Is an operation that converts a value of one data type into a value of another data type
Software development lifecycle
Is a multistage process that includes requirements specification, analysis, design, implementing, testing, deployment, maintenance
Round off error
The difference between the calculated approximation of a number and its exact mathematical value
Primitive data type
Data type where values are not objects (logical values, integers, floating point numbers, single characters)
Arithmetic operator
Operator for executing mathematical functions, such as addition, subtraction, division, multiplication.
Logical operator
Operator used to run logical functions, such as negation, logical AND, logical OR, logical XOR
Relational operator
Operator used to compare expression against each other
Equality test operator
A relational operator used to run functions that test for equality or non-equality in which operands determine whether values or references are compared
String concatenation
A function of data type String which creates a new string from 2 existing strings
Control structures
Elements of programming language for conditional or nested execution of statements
Package
An element used for structuring Java classes of a development project
Boolean expression
Is an expression that evaluates to a Boolean value
If statement
Is a construct that enables a program to specify alternative paths of execution
Flowchart
A diagram that describes an algorithm or process, showing steps as boxes of various kinds and their order by connecting these boxes with arrows
Nested if statement
The inner if statement in the another if statement
Fail-through behaviour
Once a case in switch statement is matched, the statements from the matched case are executed until the break statement or the end of the switch statement is reached
Conditional operator
(a ternary operator) operator that evaluates an expression based on a condition
Conditional branch
A control structure that is used to execute statements based on multiple, mutually exclusive conditions
Loop
A control structure used for executing statements repeatedly
Debugging
Process of finding and fixing logical errors in a program
Escape character
Special notation that consists of a backslash followed by a character or combination of digits
String
Sequence of characters
IS-A relationship
The relationship that expresses the fact that a class is a special type of another class
Superclass
The class from which other classes are derived
Subclass
The class that specifies a superclass by implementing an improved functionality with additional methods and attributes
Inheritance
Type of relationship that enables the abstraction of common attributes in a superclass, therefore reducing repetition in design
Assignment compatibility
A variable of the type of a superclass can also be assigned to subclass objects
Extension
A concept that used by Java to implement inheritance
Overriding
The process of implementing an inherited method
Loop continuation condition
A boolean expression that controls the execution of a loop body
Counter-controlled loop
A loop that uses the control variable to count the number of iterations
Sentinel value
The special input value that signifies the end of the input
Sentinel-controlled loop
A loop that uses a sentinel value to control its execution
Control variable
A variable that is used in a loop to control how many times the loop body is executed and when the loop terminates
Pre-test loop
A loop where loop continuation condition is checked BEFORE the loop body is executed
- while loop
- for loop
Post-test loop
A loop where loop continuation condition is checked AFTER the loop body is executed
- do while loop
Nested loop
A loop that consists of an outer loop and one or more inner loops
Method definition
Method name, parameters, return value type, body
Value returning method
A method that returns a value
Void method
A method that does not return a value
Method body
A collection of statements that implement the method
Method invocation
Calling a method
Pass-by-value
If the argument is a variable, than a literal value, is passed to the method as a parameter
Method overloading
Two methods have the same name but different parameter list within one class.
Java determines which method is used by method signature
Ambiguous invocation
There are two or more possible matches for invocation of a method but compiler cannot determine the most specific match.
Ambiguous invocation causes a compile time error
Local variable
A variable that is defined inside a method
Method abstraction
A separation the use of a method from its implementation. The client can use a method without knowing how it is implemented
Top-down approach
An implementation of one method in the structure chart at a time from top to down
Stub
A simple but incomplete version of a method that is used for the methods waiting to be implemented
Bottom-up approach
An implementation of one method in the structure chart at a time from down to top
Attribute
An element of objects that is used for saving concrete values
Array
A data structure which stores a fixed-size sequential collection of elements of the same type
Indexed variable
An index that is used to access elements of an array
Array initializer
A shorthand notation, which combines the declaration, creation and initialization of an array in one statement
type[] arrayRefVar = {values…}
For-each loop
A for loop that allows to traverse an array or a list without using an index variable
Anonymous array
An array with no explicit reference variable
Precondition
A thing that is true before the method is invoked
Postcondition
A thing that is true after the method is returned
Strictly equal arrays
Arrays with same corresponding elements
Abstract class
A class which instances cannot be created; where common features are grouped together and an interface that must be supported by derived classes is defined
Abstract method
A method that has a signature but no method body; it defines the functionality that must be implemented in subclasses
Polymorphism
A declared variable of the type of a particular class can also accept instances of the subclass
Instanceof operator
An operator used to run a test of class membership
Class variable
An attribute that is same for all instances of a class and is accessed through the class name
New operator
An operator that creates a new object for a particular class
Standard constructor
A special method for creating objects of a class. Can only exist once per class
Empty standard constructor
If a constructor is not defined, the compiler explicitly adds an empty standard constructor
Garbage collection
Automatic memory management in Java
Overloaded standard constructor
A constructor used to initialize an object with values that are only determined at runtime, so this constructor defines a parameter list
Copy constructor
A constructor used for cloning objects
Deep copy
All reference data types are copied
Shallow copy
Only primitive data types and strings are copied
Ragged array
A 2D array where rows have different length
2D array
Array of 1D arrays
3D array
Array of 2D arrays
Multidimensional array
An array where each element is another array
State of the object
Data fields with their current values
Behavior of an object
Methods of an object
Class diagram
A special UML notation to display class template
Client of the class
The program that uses the class
Dot operator
An operator used to access data and methods via the object’s reference variable
Instance variable
A data field that is dependent on a specific instance
Calling object
An object on which an instance method is invoked
Visibility modifier
An element that specifies how data fields and methods in a class can be accessed from outside the class
Public visibility
Visible: class, package, subclasses, global
Protected visibility
Visible: class, package, subclasses
Default visibility
Visible: class, package
Private visibility
Visible only inside the class
Accessor method
A method to return a value of a private data field
Mutator method
A method to set a new value for a private data field
Pass by sharing
The object referenced in the method is the same object as the one being passed
Immutable object
An object whose contents cannot be changed once the object has been created
Hidden variable
If a local variable has the same name as an instance variable, the local variable takes precedence
This (keyword)
A name of a reference that the object can use to refer to itself
Error signal
A code that specifies an exception with a value that is outside the valid value range (e.g. is negative)
Try-catch block
An structure in which critical program instructions are contained in the try block and exceptions are handled in the catch block
Throws (keyword)
A keyword that indicates in the method signature which exceptions can be thrown by the method
Finally block
The block that contains statements that are executed independent of the occurrence of an exception
Dynamic binding
The most suitable implementation will be selected by the runtime environment
Use association
The association that indicates that a class uses an interface
Class abstraction
A level of abstraction which separates a class implementation from how the class is used
Procedural programming paradigm
Action driven; data is separated from actions
Association
A general binary relationship that describes an activity between two classes
Multiplicity
A number or an interval that specifies how many of the class’s objects are involved in the relationship
Aggregation
A special form of association that represents an ownership relationship between two objects
Composition
An existence of the aggregated object (subject) is dependent on the aggregating object (owner). Example: Name depends on Student
Stack
A data structure that holds data in LIFO fashion
Boxing
A conversion of a primitive value to a wrapper object
Unboxing
A conversion of a wrapper object into a primitive data value
Interned string
A unique instance for string literals with the same character sequence in order to improve efficiency and save memory
Regular expression
A string that describes a pattern for matching a set of strings
Synchronized
Only one task is allowed to execute the method
Capacity of the string builder
A number of characters, that string builder is able to store without having to increase its size
Subtype
A type defined by a subclass
Supertype
A type defined by a superclass
Multiple inheritance
The capability to derive a subclass from several classes
Single inheritance
A class may inherit directly only from one superclass
Constructor chaining
Constructing an instance of a class invokes the constructors of all superclasses along the inheritance chain
@Override annotation
An annotation which denotes that the annotated method is required to override a method in its superclass. If the method is not overriden the compiler reports an error
Declared type
A type that declares a variable
Actual type
An actual class for the object referenced by a variable
Implicit casting
Super obj = new Subclass()
Explicit casting
subclass obj = (subsclass) super
Upcasting
A casting of an instance of a subclass to a variable of a superclass
Downcasting
A casting of an instance of a superclass to a variable of a subclass
ClassCastException
An unchecked exception that is thrown if the superclass object is not instance of a subclass object.
Exception
An object that represent an error or a condition that prevents execution from proceeding normally
System error
An instance of the Error class, that represents an internal system error. Can’t be recovered
Unchecked exception
A subsclass of a RuntimeException class, that describes programming errors
Checked exception
A subclass of Exception class, that represent an error outside the control of the program (IO error etc.)
Declaring exceptions
Every method should state types of checked exceptions it might throw
Exception handler
Code that handles an exception
Stack trace
A list of all methods in the call stack which provides valuable information for debugging runtime errors
Chained exception
Throwing an exception along with another exception
Try-with-resources
A construct that automatically closes resources. Resources should be an instance of AutoCloseable interface
Interface
A class-like construct for defining common operations for objects
Interface inheritance
A relationship between the class and the interface
Default method
A method in an interface that provides a default implementation for the method
Marker interface
An interface with an empty body
Principle of cohesion
A class should describe a single entity, and class operations should logically fit together to support a coherent purpose
Principle of clarity
A class should have a clear contract that is easy to explain and easy to understand
Principle of completeness
A class should provide a variety of ways for customization through properties, methods, constructors