Solved

If the Combo Box AddressBox Contains a List of Strings

Question 2

Multiple Choice

If the combo box addressBox contains a list of strings, why is the returned value of getSelectedItem method in the following code cast to String?
String selectedAddress;
SelectedAddress = (String) addressBox.getSelectedItem() ;


A) This is not necessary.
B) Because the syntax of the method requires it
C) It makes the program more readable.
D) Because the return type of the method is an Object

Correct Answer:

verifed

Verified

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents