OCA Summary 1 pag 40 Flashcards Preview

OCA Summary > OCA Summary 1 pag 40 > Flashcards

Flashcards in OCA Summary 1 pag 40 Deck (42)
Loading flashcards...
1
Q

Java classes consist of members called ___ and ___.

A

fileds and methods

2
Q

An ___ is an instance of a Java class

A

object

3
Q

There are three styles of comments:

A

single-line comment
multiline comment
Javadoc comment

4
Q

Java beings program execution with a ____ method

A

main()

5
Q

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

A

public static void main(String[] args)

6
Q

Arguments are passed in after the ___ ___

A

class name

7
Q

Arguments are indexed starting with ___

A

0

8
Q

Java code is organized into folders called ____

A

packages

9
Q

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

A

import statement

10
Q

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

A

classes

package

11
Q

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

A

java.lang

12
Q

Constructors create Java ____

A

objects

13
Q

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

A
class name
return type
14
Q

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

A

fields and block of code

constructor

15
Q

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

A

Primitive types

16
Q

Reference types can have methods and be assigned to ___

A

null

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.

A

zero

null

21
Q

___ variables must be specifically initialized.

A

Local

22
Q

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

A

letters
numbers
$ (dollar sign)
_ (underscore)

23
Q

Identifiers may not begin with ___

A

numbers

24
Q

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

A

accessed

25
Q

There are three kinds of variables in Java, depending on their scope:

A
Instance variables
class variables
local variables
26
Q

___ variables are the nonstatic fields of your class

A

Instance variables

27
Q

Instance variables are the non____ fields of your class

A

static

28
Q

___ variables are the static fields within a class

A

class variables

29
Q

___ variables are declared within a method

A

local variables

30
Q

For some class elements, ___ matters within the file

A

order

31
Q

T or F

The package statement comes first if present.

A

true

imports

32
Q

Name the order in which class elements need to be:

methods
import statement
fields
package statement

A

package statement
imports
fileds and methods are allowed to be in any order within the class

33
Q

___ ___ is responsible for removing objects from memory when they can never be used again.

A

Garbage Collection

34
Q

An object becomes eligible for garbage collection when there are no more ___ to it or its ____ have all gone out of scope

A

references

35
Q

The finalize() method will run ___ for each object if/when it is first garbage collected.

A

once

36
Q

Java code is object oriented, meaning all ___ is ___ in ___.

A

All Code is Defined in Classes

37
Q

____ ____ allow classes to encapsulate data.

A

Access modifiers

38
Q

Access modifiers allow classes to ___ ___.

A

encapsulate data

39
Q

Java is platform independent, ___ to bytecode

A

compiling

40
Q

Java is platform independent, compiling to ___

A

bytecode

41
Q

Java is robust and simple by not providing ___ or operator ___.

A

pointers

operator overloading

42
Q

Java is secure because it runs inside a ____ ____

A

virtual machine