Exam Essentials 1 bag 41 Flashcards
Be able to write code using a main() method.
A main() method is usually written as public static void main(String[] args).
Arguments are referenced starting with args[0]. Accessing an argument that wasn’t passed in will cause the code to ___ an ___
throw and exception
Understand the effect of using packages and imports.
A ___ has the same name as the ____.
It looks like a method without a ____ ____
constructor
return type
Be able to identify legal and illegal declarations and instantiations.
Multiple variables can be ____ and _____ in the same statement when they share a ___.
declared
instantiated
type
___ variables require an explicit initialization.
Local variables
_____ may contain:
____, ____, ___ and ___.
Identifiers letters numbers $ _
Identifiers may not begin with ____
numbers
_____ ____ may contain ____ between numbers.
Number literals
underscores
Number literal may begin with _- _ (decimal) _ (octal) \_\_ and \_\_ (hex) \_\_ and \_\_ (binary)
0-1
0
0x and 0X
0b and 0B
Be able to determine where variables go into and out of scope.
All variables go into scope when they are ___.
declared
____ variables go out of scope when the block they are declared ___
local
ends
____ variables go out of scope when the object is garbage collected.
instance variables
___ variables remain in scope as long as the program is running.
class variables
An instance variable goes out of scope when the object is ___ ____
garbage collected
Class variables remain in scope as long as the ___ is running
program
Be able to recognize misplaced statements in a class.
T or F
Package and imports statements are optional.
True