3. Assignments Flashcards

1
Q

What are the values in an array of objects or primitives, when the respective array is instantiated ?

A

Objects within the array are not instantiated automatically, but all the references get the default value of null. Primitives in an array also get default values.

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

Which variables have default values and which not ?

A

Instance variables are always initialized with a default value.

Local/automatic/method variables are never given a default value. If you attempt to use one before initializing it, you’ll get a compiler error.

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

What is shadowing ?

A

Shadowing occurs when two variables with different scopes share the same name. This leads to hard-to-find bugs and hard-to-answer exam questions.

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

How you can run Garbage Collection ?

A

Only the JVM decides when to run the GC; you can only suggest it.

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