112k views
2 votes
which of these variable declarations will the variable remain uninitialized unless it is explicitly initialized?1)Declaration of an instance variable of type int.2)Declaration of a static variable of type float.3)Declaration of a local variable of type float.4)Declaration of a static variable of type Object.5)Declaration of an instance variable of type int[].

1 Answer

0 votes

Answer:

Option 3: Declaration of a local variable of type float

Step-by-step explanation:

In Java programming, a local variable doesn't possess a default value. This means a value must be explicitly initialized to the local variable before it can be used.

The instance variable and static variable, on another hand, have default value which is dependent on the data type. For example, an instance or a static variable of type int is 0. If the data type is boolean, the default value is false.

User Techjourneyman
by
4.8k points