MCQOPTIONS
Saved Bookmarks
| 1. |
What is the output of this program?public class Result { public static void main(String[]args) { String[] array = { "for", "tea", "too" }; String num= (array.length > 2) ? array[2]: null; } } |
| A. | The variable num is set to elements[0]. |
| B. | The variable num is set to null |
| C. | An exception is thrown at run time |
| D. | Compilation error |
| E. | None of these |
| Answer» B. The variable num is set to null | |