Level 87 Level 89
81 words 0 ignored
Ready to learn Ready to review
Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.
What package is the String class in?
What does java.lang do?
defines commonly used classes (ex. System, Math, Object, String)
And object stores it states in _______.
procedures for constructing new object in class/ initializing its fields
It is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed.
The kind of information a variable stores.
A method must match _______.
method does not return any value
What does the keyword void in a method header mean?
encapsulation (information hiding)
situation where class interacts with other classes only through constructors/ public methods
helps hide implementation behind an interface or API
Constructors and methods can call other public/ private methods of the _______ class.
Accessible by any class in the program.
What does a subclass inherit from a superclass?
graphical representation of control flow
flowchart shape for input/ output
flowchart shape for processing step
flowchart shape for decision
used as a general term for things that store data in a program.
iterations/ recursions can be used to repeat same steps multiple times
same one applies to any "size" task or any input values
does not depend on specific computer language/ platform (though may depend on general computing model)
repeat same instructions multiple times; start with initial variable values (some change each cycle); supported by high-level programming languages
When do iterations stop?
when the tested condition becomes false
describes procedure for a particular task in terms of applying the same procedure to a similar but smaller task
Must have a _______ when the task is so simple that no recursion is needed
smaller parameter value
A recursive method calls itself with what?
How does recursion work?
implemented like iterations but is hidden from the programmer
Recursion is assisted by what?
nested structures or branching processes
Recursion is especially useful for dealing with what?
finds the GCF of two positive integers
an ordered collection (sometimes called a sequence); can contain duplicate elements; have precise control over where each element is inserted in the list and can be access elements by their integer index (position)
start at the first element; while more elements remain, process the next one
type of search where the number of comparisons is proportional to the length of the list
type of search involving "divide and conquer"; target value always compared with middle element of remaining search range
A method or a function.
What carries out a specific task within a class?
What is an internal decomposition unit because it is not a stand-alone module, therefore must belong to a class?
What is local data?
Data declared within a function that is known only to that function.
When does local data exist?
Only during the execution of the function containing it.
When does a function start executing?
When it is called by another function.
A function call is also known as a _______.
What are three general categories of functions?
Simple functions, value-returing functions, and functions with parameters.
What is a simple (void) function?
A function that does not return any value to the function that invoked it.
What are the attributes of a method?
Method name, purpose of the method, return type, number and types of parameters.
public/private in front, usually private
What is special about a field?
Format of variable
sometype someName; or ""=expression;
a variable thats value, once assigned, cannot change (initialized final variable is a constant)
yes, but may cause bugs
can you use thesame name for a field and local variable?
8 primitive data types
boolen, byte, char, double, float, int, long, short
these types do not have properties of objects
Data type indicative of a single symbol
public int cadence;
floating-point real number
The String class represents an immutable, e.g. cannot be changed, string of characters with its own methods.
special about strings (2)
double quotes for literal string, can use + operator
types of constants(2)
back slash and single character
initialized final fields
Does a constant have to be initialized right away
no its final value can be set in a constructor
Why use symbolic constants
simplifies program matinence, (can make changes to constant, will change throughout program), readibility, easier to change constant into variable
Symbolic constants (like variables) are declared...
with a particular data type and defined only within their scope
the class (all methods/constructors)
scope of field extends through
the scope of a local variable extends
from declaration to end of the block
A software object's state is stored in a
can you get true ratio with ints?
no you have to turn them into doubles
Removing the decimal portion of a number when casting a double to an int.
how do you conver ints to doubles
cast operator, ex) double ratio = (double)a/b
what do you do to round to the nearest integer
compatible data types
cast operator applies only to
a += b
a = a + b
a = a + 1 * incremented after use in expression
a = a -1* incremented after use in expression
a = a - 1* incremented before
when using + operator for string concatenation
at least one of the two operands must be a string
+= for concatenation
left operand must be string
turn value into string?
concatenate with empy string or call toString method
Normal control flows _______ from one statement to the next during program execution.
alter the execution sequence of a program
What do calls to methods, iterative statements (loops), conditional (if-else) statements, switch statements, and exceptions have in common?
tells the program to choose and execute one fragment of code or another depending on some condition
chooses a particular fragment of code out of several based on the value of a variable or expression
If-else control structure allows _______.
special CPU instructions that support conditional branching; tests a certain condition and tells the CPU to "jump" to a specified instruction depending on the result of a test