Final Exam Flashcards
A program that translates Java source code into a platform-independent format
compiler
A program that executes Java files
interpreter
You can use a Scanner object to:
get the next token in an input line
Groups of related classes are organized into
packages
The order of precedence, from first to last, for arithmetic operations is
increment, multiply, add
A boolean operator that only evaluates the second condition when necessary is a(n)
short-circuit
Modification is not a what?
Basic Control Structure
The Java implementation of the case structure uses which keyword?
switch
The keyword used to code a class method is
static
Which statement is always optional in exception handling?
finally
Which statement is required to match a try block?
catch
Division by zero would be an example of which type of exception class?
Arithmetic
Exception handing using the try statement is done by
coding a try block around the statement that may cause the exception
An object that contains information about an error that has occurred is a(n)
exception
After an exception has occurred, the remaining statement in the try block are
skipped
What is the value of the variable x after the following statements have run?
int[ ] a = {1, 2, 3};
int x = 0;
for (int n : a)
x+=n;
6
What is printed by the following for loop?
int[ ][ ] m = { {4, 3}, { 2, 1} };
for (int i=0; i<m.length; i++)
System.out.print (m[i][i]);
41
What is the value of nums.length for the following array?
int[ ][ ] nums = { {1, 2}, {3, 4, 5}, {6, 7, 8, 9}, {10} };
4
What is the value nums[1].length for the following array?
3