Variables Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Local variables

A

A variable inside of a method or constructor that can’t be accessed outside of that method or constructor. It must be assigned before it is used.

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

Instance variables

A

Instance variables are the attributes of the object. They change based on which instance of the class you are looking at.

Numbers are initialized to 0.
Reference variables are initialed to null.

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

Static variables

A

Static variables are special because they do not need to be called on a specific object of a class, but can be called on the class. They are constants that don’t change. For example, Integer.MAX_VALUE;

Numbers are initialized to 0.
Reference variables are initialed to null.

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

Reference variables

A

They point to objects( Including things like Cat, String, and Integer, but not int, char, or other primitive types.

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

Primitive variables

A

They point to primitive values like int, char, long, and double.

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

Formal parameters/method parameters

A

These are the types and names of the parameters in a method.

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

Actual parameters

A

These are the values passed in to a method

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

Access Specifiers

A

The ‘public’ or ‘private’ at the beginning of methods or classes that tell where it can be accessed.

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

public

A

Once the class is imported, can be used

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

Private

A

Can not be used outside of the class, imported or not

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

encapsulation

A

This is when you hide some unnecessary details for users by making methods and other things private.

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

Declaring Class

A

The class a method is in

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

mutator/setter methods

A

methods that allow users to change an instance variable according to the code inside.

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

accessor/getter

A

Methods that allow users to see a instance variable, but not change it.

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