if(check4Biz(storeNum) != null) {} Referring to the above, what datatype could be returned by method check4Biz()?
-
boolean
-
int
-
String
-
char
The code checks if check4Biz(storeNum) is not null, meaning the method must return a reference type (an object, not a primitive). String is a reference type and can be null. boolean, int, and char are primitive types and cannot be null.
To answer this question, we need to understand the return type of the method check4Biz().
Based on the given code snippet if(check4Biz(storeNum) != null) {}, we can infer that the method check4Biz() is returning a reference type that can be compared to null.
Let's go through each option to determine the correct return type:
Option A) boolean - This option is incorrect because a boolean value cannot be compared to null. It can only have the values true or false.
Option B) int - This option is incorrect because an int value also cannot be compared to null. It can only hold numeric values.
Option C) String - This option is correct because a String is a reference type that can be compared to null. It can hold text values and can be compared to null to check if it is empty or uninitialized.
Option D) char - This option is incorrect because a char value cannot be compared to null. It can only hold single character values.
Therefore, the correct answer is C) String. The method check4Biz() is expected to return a String datatype.