207k views
5 votes
Which of the following statements is true?

a. The default value for an instance variable of type String is void
b. Every instance variable has a default initial value—a value provided by Java when you do not specify the instance variable’s initial value
c. Local variables are automatically initialized
d. The argument types in the method call must be identical to the types of the corresponding parameters in the method’s declaration

1 Answer

4 votes

Final answer:

The correct statement is that every instance variable has a default initial value provided by Java when an initial value is not specified.

Step-by-step explanation:

The correct statement among the options is b. Every instance variable has a default initial value—a value provided by Java when you do not specify the instance variable’s initial value.

For example, if you declare an instance variable of type int, it will have a default value of 0. If you declare an instance variable of type boolean, it will have a default value of false.

This default initial value is assigned to instance variables if you don't explicitly provide an initial value when declaring them.

User David Nordvall
by
8.2k points