OCA Summary 1 pag 40 Flashcards
(42 cards)
Java classes consist of members called ___ and ___.
fileds and methods
An ___ is an instance of a Java class
object
There are three styles of comments:
single-line comment
multiline comment
Javadoc comment
Java beings program execution with a ____ method
main()
The most common signature for the main() method run from the command line is:
public static void main(String[] args)
Arguments are passed in after the ___ ___
class name
Arguments are indexed starting with ___
0
Java code is organized into folders called ____
packages
To reference classes in other packages, you use an ___ ____.
import statement
A wildcard ending an import statement means you want to import all ___ in that ____
classes
package
What is the special package that does not need to be imported?
java.lang
Constructors create Java ____
objects
A constructor is a method matching the ___ ___ and omitting the ___ ___
class name return type
When an object is instantiated, ___ and ____ of code are initialized first. Then the ___ is run.
fields and block of code
constructor
____ ____ are the basic building blocks of Java types. They are assembled into reference types.
Primitive types
Reference types can have methods and be assigned to ___
null
In addition “normal” numbers, ____ ____ are allowed to begin with 0 (___), 0x (__), 0X (___), 0b (___) or 0B (__).
numeric literals
octal
hex
binary
Numeric literals are also allowed to contain ___ as long as they are directly between two other ___
underscores
numbers
Declaring a variable involves starting the ___ ___ and giving the variable a ___.
data type
name
Variables that represent fields in a class are automatically initialized to their corresponding “___” or __ value during instantiation.
zero
null
___ variables must be specifically initialized.
Local
Identifiers may contain ___, ___, __, or __.
letters
numbers
$ (dollar sign)
_ (underscore)
Identifiers may not begin with ___
numbers
Scope refers to that portion of code where a variable can be ___
accessed