A statement that establishes an identifier and associates attributes with it
What is a Compiler?
A program that’s used to translate source code into code that can be executed by a computer
What is an Exception?
An event during program execution that prevents a program from continuing normally; generally, an error
What is an Identifier?
The name of an item in a program written in the Java programming language
What is a Literal Constant?
A value that is taken literally at each use
What is a Numeric Constant?
A number whose value is taken literally at each use
What are Reference types and what are they constructed from?
Complex data types that are constructed from primitive types
What is a Variable Declaration?
Statement that reserves a named memory location
What is a Named Constant?
A memory location whose declaration is preceded by the keyword "final", and whose value cannot change during program execution.
What is a Strongly typed language?
One in which all variables must be declared before they can be used
What is an Assignment operator and what does it do?
The equal sign
Any value to the right of the equal sign is assigned to the variable on the left of the equal sign
What is Initialization?
An assignment made when you declare a variable
What is Assignment?
The act of providing a value for a variable
What is associativity?
Refers to the order in which operands are used with operators
What is a Garbage Value?
The unknown value store in an uninitialized variable
What is a Named Constant (Symbolic Constant)and what keyword is used to instantiate it?
A memory location whose declaration is preceded by the keyword final and whose value cannot change during program execution
What is an Explicit Conversion?
The data-type transformation caused using a cast operator
What is a Unary Cast Operator and what does it do?
A more complete name for the cast operator that performs explicit conversions
Unary operator
Uses only one operand
Escape Sequence
Begins with backslash followed by a character
The pair represents a single character
What does it mean to Consume an Entry?
To retrieve and discard an entry without using it
Implicit Conversion (Promotion)
The automatic transformation of one data type to another
What is a double-precision floating point number stored in?
A double
What is a single-precision floating point number stored in?
A float
What does the Cast Operator do?
Performs an explicit-type conversion
It is created by placing the desired result type in parenthesis before the expression to be converted
Token
A unit of data used by the scanner class
Arguments
All data items sent to methods in a method call
Parameters
The data items received by a method
Actual Parameters
The arguments in a method call
Formal Parameters
The variables in a method declaration that accept the values from actual parameters
What does the return statement do?
Ends a method and frequently sends a value from a called method back to the calling method
What is an "is-a relationship"?
The relationship between an object and the class of which it is a member
What do mutator methods do?
Set values
What do Accessor methods do?
Retrieve values
What is a "reference to an object"?
The name for a memory address where the object is held
What is a constructor?
A method that establishes an object
What is a default constructor?
Any constuctor that accepts no parameters
Primary Key
A unique identifier for data within a database
Abstract data type
A type whose implementation is hidden and accessed through its public methods
What is "implementation hiding"?
A principle of OOP that describes the encapsulation of method details within a class
What is a method and what must it include?
A series of statements that carry out a task.
A declaration (or header or definition)
Opening curly brace
Body
Closing curly brace
What does the method declaration contain?
Optional: access modifiers
return type for the method
method name
opening parenthesis
Optional: list of parameters
closing parenthesis
What does a class header contain?
Optional: access modifier
the keyword: class
any legal identifier you choose for the name of your class
p.127
Fields and methods used with object instantiations are
(static/nonstatic)?
nonstatic
p.127
What is a constructor?
A constructor always has the same name as what?
Constructors are instance methods
The class of which it is a member
How are constructors invoked?
Using the modifier "new" operator
What is a class?
An abstract, programmer defined, data type
What does object-oriented design do?
It models the characteristics of abstract or real objects using classes and objects
What does JIT stand for and what does it do?
Just-in-time compiler
Converts byte code directly into machine language
What does JVM stand for and what does it consist of?
Java Virtual Machine
byte code instruction set
set of registers
stack
garbage-collected heap
an area for storing methods
What is a Block?
The code within a set of curly braces
p.136
How do you create an instance of a class?
By using the "new" operator followed by the class name
What is a Method?
A function defined in a class
What must be included in a method?
What must a method declaration contain?
A declaration (or header or definition)Opening and closing curly braces ({ })
A body
Optional access modifiers
The return type for the method
The method name
Opening and closing parentheses
An optional list of method parameters (multiple parameters are separated by commas)
What are instance methods and what is another term for it?
Methods that refer to objects (used with object instantiations).
nonstatic methods
What is a multithreaded program?
A program that’s designed to have parts of its code execute concurrently
What is a "package"?
A set of related classes
What is a field in java?
A data member of a class
What is a servlet and what older scripting code do they replace?
An executable program that has no“main” routine and so must run inside another environment.
CGI
Do variables have to be declared in Java and what do variable declarations include?
Yes
A data type that identifies the type of data that the variable will store
An identifier, which is the variable’s name
Optional-an assigned value when you want a variable to contain an initial value
An ending semicolon
What is abstraction?
The programming feature that allows you to use a method name to encapsulate a series of statements
Actual parameters
Method parameters
Formal parameters
The variables in the method declaration
What method return type would you use if you want the method to return nothing?
Void
What are the steps to creating a Class?
Assign the class a name
Determine the data and methods that will be included in the class
Create a class header
What are the three parts of a Class header?
An access modifier (optional - controls who can use classes, data members, and methods)
A keyword class
A legal identifier or name of the class
What do mutator methods do?
Set values
p.126
What do Accessor methods do?
Retrieve values
p.126
What does the return statement do?
Ends a method and frequently sends a value back from the called method to the calling method.
p.126
What is an "is-a relationship"?
The relationship between an object and the class of which it is a member.
p.126
What does assigning private access to a field mean?
No other classes can access the field's values, and only methods of the same class are allowed to set, get or otherwise use private variables.
p.126
What is an abstract data type?
A type whose implementation is hidden and accessed through its public methods.
What is a constructor and what keyword is used to invoke a constructor?
A method that establishes an object. They have the same name as the class.
new
What happens if you don't define a constructor for your class?
A default, parameterless, constructor is automatically created by the compiler. The default constructor calls the default parent constructor (super()) and initializes all instance variables to default value (zero for numeric types, null for object references, and false for booleans).
True or False?
-Method headers end in a semicolon
False
What is overloading a method?
How is the correct method chosen?
Writing multiple methods with a shared name, but each version has different arguments.
The correct version of the method is chosen base on which arguments you pass to it.
p.142
When an overloaded method has two versions that could be easily confused by the program, you have a problem with _____
Ambiguity
p.144
Why would you write your own default constructor?
So that you can ensure that fields within classes are initialized to some appropriate default value. When you write your own constructors, they can receive parameters.
p.147
If a method isn’t associated with an object, it’s a _____ method.
class
Define:
literal constant
A value that doesn’t change.
SG p.31
Define:
constant variable
A variable whose purpose is to hold a value that doesn’t change.
SG p.31
What is the purpose of Symbolic constants?
They enable you to prevent other methods from changing a variable’s value by inserting the keyword "final" into the declaration.
You should use ________ letters when writing constant fields. This will help you to visually distinguish symbolic constants from variables.
uppercase
A library of classes is also called a ______
Package
SG p.32
List the three reasons for using symbolic constants rather than literal ones.
P.158
What is a reference?
An object's memory address
p. 150
A reference to an object's nonstatic class method is called a ____ reference.
Is the above reference always necessary?
this
It is usually implied, but sometimes you actually have to include the keyword "this" to make a class work correctly.