OCA Summary 1 pag 40 Flashcards

(42 cards)

1
Q

Java classes consist of members called ___ and ___.

A

fileds and methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

An ___ is an instance of a Java class

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

There are three styles of comments:

A

single-line comment
multiline comment
Javadoc comment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Java beings program execution with a ____ method

A

main()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The most common signature for the main() method run from the command line is:

A

public static void main(String[] args)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Arguments are passed in after the ___ ___

A

class name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Arguments are indexed starting with ___

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Java code is organized into folders called ____

A

packages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To reference classes in other packages, you use an ___ ____.

A

import statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A wildcard ending an import statement means you want to import all ___ in that ____

A

classes

package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the special package that does not need to be imported?

A

java.lang

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Constructors create Java ____

A

objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A constructor is a method matching the ___ ___ and omitting the ___ ___

A
class name
return type
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When an object is instantiated, ___ and ____ of code are initialized first. Then the ___ is run.

A

fields and block of code

constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

____ ____ are the basic building blocks of Java types. They are assembled into reference types.

A

Primitive types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Reference types can have methods and be assigned to ___

A

null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

In addition “normal” numbers, ____ ____ are allowed to begin with 0 (___), 0x (__), 0X (___), 0b (___) or 0B (__).

A

numeric literals
octal
hex
binary

18
Q

Numeric literals are also allowed to contain ___ as long as they are directly between two other ___

A

underscores

numbers

19
Q

Declaring a variable involves starting the ___ ___ and giving the variable a ___.

A

data type

name

20
Q

Variables that represent fields in a class are automatically initialized to their corresponding “___” or __ value during instantiation.

21
Q

___ variables must be specifically initialized.

22
Q

Identifiers may contain ___, ___, __, or __.

A

letters
numbers
$ (dollar sign)
_ (underscore)

23
Q

Identifiers may not begin with ___

24
Q

Scope refers to that portion of code where a variable can be ___

25
There are three kinds of variables in Java, depending on their scope:
``` Instance variables class variables local variables ```
26
___ variables are the nonstatic fields of your class
Instance variables
27
Instance variables are the non____ fields of your class
static
28
___ variables are the static fields within a class
class variables
29
___ variables are declared within a method
local variables
30
For some class elements, ___ matters within the file
order
31
T or F | The package statement comes first if present.
true | imports
32
Name the order in which class elements need to be: methods import statement fields package statement
package statement imports fileds and methods are allowed to be in any order within the class
33
___ ___ is responsible for removing objects from memory when they can never be used again.
Garbage Collection
34
An object becomes eligible for garbage collection when there are no more ___ to it or its ____ have all gone out of scope
references
35
The finalize() method will run ___ for each object if/when it is first garbage collected.
once
36
Java code is object oriented, meaning all ___ is ___ in ___.
All Code is Defined in Classes
37
____ ____ allow classes to encapsulate data.
Access modifiers
38
Access modifiers allow classes to ___ ___.
encapsulate data
39
Java is platform independent, ___ to bytecode
compiling
40
Java is platform independent, compiling to ___
bytecode
41
Java is robust and simple by not providing ___ or operator ___.
pointers | operator overloading
42
Java is secure because it runs inside a ____ ____
virtual machine