Which lines of code, when inserted at //INSERT CODE HERE, will print the following:.
BASKETBALL:CRICKET:TENNIS:SWIMMING:
enum Sports { TENNIS, CRICKET, BASKETBALL, SWIMMING; public static void main(String args[]) { // INSERT CODE HERE } }
values()
) System.out.print(val+":");orderedValues()
) System.out.print(val+":");naturalValues()
) System.out.print(val+":");ascendingValues()
) System.out.print(val+":");e
Option (a) is incorrect.
The code in this option will print the natural order of the definition of the enum (the order in which they were defined):.
TENNIS:CRICKET:BASKETBALL:SWIMMING:
Options (b), (c), and (d) define nonexistent enum methods.
Code in these options won't compile.