003 - Variables Flashcards

1
Q

The term “class variable” is another name for ___.

A

Static fields, which have a fixed value regardless of instantiation and use the keyword static

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

The term “instance variable” is another name for ___.

A

A non-static field, that belongs to an object

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

A local variable stores temporary state; it is declared inside a ___.

A

Method

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

A variable declared within the opening and closing parenthesis of a method signature is called a ____.

A

Parameter

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

What are the eight primitive data types supported by the Java programming language?

A
Byte
Short
Int
Long
Float 
Double 
Boolean
Char
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Character strings are represented by the class ___.

A

Java.lang.String

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

An ___ is a container object that holds a fixed number of values of a single type.

A

Array

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

Create a small program that defines some fields. Try creating some illegal field names and see what kind of error the compiler produces. Use the naming rules and conventions as a guide.

A

Practice

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

In the program you created in Exercise 1, try leaving the fields uninitialized and print out their values. Try the same with a local variable and see what kind of compiler errors you can produce. Becoming familiar with common compiler errors will make it easier to recognize bugs in your code.

A

Practice

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

the ______ modifier tells the compiler that there is exactly one copy of this variable in existence

A

static

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

What’s the special word to declare a variable as local

A

There is no word todo this

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

What is args in public static void main(String[] args).

A

The parameter

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