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


D) Because the return type of the method is an Object

Computer Science & Information Technology

You might also like to view...

Here is an iterative function. Write a recursive function that does the same thing. Be sure you write the correct number of copies of the cheer, “Hip, Hip, Hurray!”. For this problem, ignore namespace issues.

``` void iter_cheers(int n) { for(int i = 0;i < n-1; i++)//this is the tricky part! cout << "Hip, "; cout << "Hurray!" << endl; } ```

Computer Science & Information Technology

With a(n) ____________________, users create a computerized database; add, modify, and delete data in the database; sort and retrieve data from the database; and create forms and reports from the data in the database.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

What must a Windows 9x or NT system have to resolve NetBIOS names across routed networks?

What will be an ideal response?

Computer Science & Information Technology

Chassis is another term for system unit.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology