Java: Variables and Constants, Loop, Methods – Flashcards

Unlock all answers in this set

Unlock answers
question
It is best to use the ____ available text editor when writing Java programs.
answer
Simplest
question
Line comments start with ____.
answer
Two forward slashes
question
____ refers to the hiding of data and methods within an object.
answer
Encapsulation
question
A program written in ____ is the most basic circuitry-level language.
answer
Machine Language
question
Programs that are embedded in a Web page are called Java ____.
answer
applets
question
A(n) ____ defines the circumstances under which a class can be accessed and the other classes that have the right to use a class.
answer
access modifier
question
If a compiler detects a violation of language rules, it refuses to translate the class to ____.
answer
machine code
question
The syntax behind any program involves executing the various statements and procedures in the correct order to produce the desired results. (t/f)
answer
false
question
If an object's methods are well written, the user is unaware of the low-level details of how the methods are executed, and the user must simply understand the interface or interaction between the method and the object.(t/f)
answer
true
question
The ____________________ is also called the Java class library; it contains information about how to use every prewritten Java class, including lists of all the methods you can use with the classes.
answer
Java API
question
In programming, named computer memory locations are called ____________________ because they hold values that might vary.
answer
variables
question
hypothetical computer used to run a Java program
answer
Java virtual machine (JVM)
question
a GUI object resembling a window in which you can place messages you want to display
answer
dialog box
question
the characteristics that define an object
answer
attributes
question
allow you to assign intuitive names to areas of computer memory
answer
high-level programming languages
question
translates an entire program before carrying out the statement
answer
compiler
question
the rules for the programming language
answer
syntax
question
any combination of nonprinting characters
answer
whitespace
question
involves executing the various statements and procedures in the correct order to produce the desired results
answer
logic
question
series of characters that will appear in output exactly as entered
answer
literal string
question
The ____ is the type to which all operands in an expression are converted so that they are compatible with each other.
answer
Unifying type
question
A data item is ____ when it cannot be changed while a program is running.
answer
constant
question
A(n) ____ dialog box displays the options Yes, No, and Cancel.
answer
confirm
question
A(n) ____ is a named memory location that you can use to store a value.
answer
variable
question
What is the value of result after the following statement is executed? int result = 2 + 3 * 4;
answer
14
question
Each primitive type in Java has a corresponding class contained in the java.lang package. These classes are called ____ classes .
answer
type-wrapper
question
When you perform _____ , whether the two operators used in the arithmetic expression are integer constants or integer variables, the result is an integer.
answer
integer division
question
The term ________ means to break into component parts.
answer
parse
question
These are the highest and lowest values that you can store in four bytes of memory, which is the size of an int variable.
answer
The legal integer values are -231 through 231-1.
question
A(n) ____________________ is a message requesting user input.
answer
prompt
question
A(n) ____________________ operator compares two items and the result has a Boolean value.
answer
relational comparison
question
true or false
answer
boolean
question
floating-point data type
answer
float
question
Java consistently specifies their size and format
answer
primitive
question
operator is represented by an equal sign (=)
answer
assignment
question
begins with a backslash followed by a character
answer
escape sequence
question
rules for the order in which parts of a mathematical expression are evaluated
answer
operator precedence
question
procedure which may result in loss of data
answer
cast
question
programming term for an unknown value
answer
garbage
question
value which can be used on either side of an operator
answer
operand
question
The arguments in a method call are often referred to as ____.
answer
actual parameters
question
When you write a(n) ____ for a class, you no longer receive the automatically written version.
answer
constructor
question
A(n) ____ is a program module that contains a series of statements that carry out a task.
answer
method
question
A(n) ____ variable is known only within the boundaries of the method.
answer
local
question
A called method is placed before the header or after the closing brace of the ____ , or in a totally different class.
answer
calling method
question
Public classes are accessible by all objects, which means that public classes can be ____ , or used as a basis for any other class.
answer
extended
question
The method ____ is the first line of a method.
answer
declaration
question
When you declare variables in a class, you most often declare _______ instance variables.
answer
static
question
The statements within a method execute only if and when the ______ is called.
answer
method
question
Everything in a Java program is a(n) ____________________, even a class.
answer
object
question
Normally, you declare constructors to be ____________________ so that other classes can instantiate objects that belong to the class.
answer
public
question
used to return value back to the calling method
answer
return statement
question
first line of a method
answer
header
question
variables you declare within a class, but outside of any method
answer
data fields
question
application or class that instantiates objects of another prewritten class
answer
class user
question
data components of a class
answer
instance variables
question
included within the method declaration parentheses
answer
parameter type
question
use without referencing an object
answer
static method
question
communications to a method
answer
arguments
question
variables in the method declaration that accept the values from the actual parameters
answer
formal parameters
question
When you properly ____ a method, you can call it providing different argument lists, and the appropriate version of the method executes.
answer
overload
question
____ variables are variables that are shared by every instantiation of a class.
answer
class
question
A method can receive ____ arguments, even if it is defined as needing double arguments.
answer
integer
question
The keyword ____ indicates that a field value is unalterable.
answer
final
question
Object-oriented programmers use the term "____" when a child class contains a field or method that has the same name as one in the parent class.
answer
override
question
A locally declared variable always ____ another variable with the same name elsewhere in the class.
answer
masks
question
The ____ statement notifies the program that you will be using the data and method names that are part of the imported class or package.
answer
import
question
An alternative to importing a class is to import an entire _______ of classes.
answer
package
question
When you overload a Java method, you write __________ with a shared name.
answer
multiple methods
question
When you pass a(n) ____________________, you pass a memory address.
answer
reference
question
A(n) ____________________ begins immediately after the method declaration and ends at the end of the method.
answer
outside or outer block
question
methods associated with individual objects
answer
instance methods
question
variable comes into existence
answer
comes into scope
question
historically accurate only from March 1, 4 A.D.
answer
GregorianCalendar
question
defines mathematical constants such as PI
answer
math class
question
using one term to indicate diverse meanings
answer
overloading
question
must be explicitly named in an import statement
answer
optional classes
question
an illegal action
answer
redeclaring a variable
question
no object associated with them
answer
class methods
question
You can leave out the ____ statements in a switch structure.
answer
break
question
The ____ operator is written as the exclamation point (!).
answer
NOT
question
Failing to include a complete ____ on each side of an && or || operator in an if statement is a common error in Java programming.
answer
boolean expression
question
When you block statements, you must remember that any you _________ within a block is local to that block.
answer
declare
question
Statements in which an if structure is contained inside another if structure are commonly called ____ if statements.
answer
nested
question
The ____ statement is useful when you need to test a single variable against a series of exact integer or character values.
answer
switch
question
An alternative to using a Boolean expression, such as someVariable == 10, is to store the Boolean expression's value in a______________.
answer
boolean variable
question
____________________ is a tool that helps programmers plan a program's logic by writing plain English statements.
answer
pseudocode
question
You are never required to use a switch structure; you can always achieve the same results with nested ____________________ statements.
answer
if
question
two ampersands
answer
AND operator
question
alternative to using a series of nested if statements
answer
switch statement
question
two possible courses of action.
answer
dual-alternative
question
> or <
answer
relational operator
question
separated with a question mark and a colon
answer
conditional operator
question
used in the OR operator
answer
pipes
question
Logical NOT operator
answer
!
question
double equal sign
answer
equality
question
A loop controlled by the user is a type of ____ loop.
answer
indefinite
question
It is important that the ____ be altered within the body of the loop.
answer
loop control variable
question
You use a unary minus sign preceding a value to make the value ____.
answer
negative
question
The process of repeatedly increasing a value by some amount is known as ____.
answer
accumilating
question
On many keyboards, the Break key is also the ____ key.
answer
pause
question
The order of the conditional expressions in the following is most important within a(n) ____ loop. while(requestedNum > LIMIT || requestedNum < 0)...
answer
nested
question
A loop that never ends is called a(n) ____ loop.
answer
infinite
question
A(n) ____________________ is a body with no statements in it.
answer
empty body
question
If a(n) ____________________ is altered both within the for statement and within the block it controls, it can be very difficult to follow the program's logic.
answer
variable
question
shortcut for incrementing and accumulating
answer
prefix++
question
multiple statements within curly braces
answer
block
question
within parentheses are three sections separated by exactly two semicolons
answer
for loop
question
operate on two values
answer
binary operators
question
part of the Thread class in the java.lang package
answer
sleep() method
question
subtracting 1 from a variable
answer
decrementing
question
technique of combining two loops into one
answer
loop fusion
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New