Suppose you write the code to display "Cannot get a driver's license" if age is less than 16 and "Can get a driver's license" if age is greater than or equal to 16. Which of the following code is the best?
```
I:
if (age < 16)
System.out.println("Cannot get a driver's license");
if (age >= 16)
System.out.println("Can get a driver's license");
II:
if (age < 16)
System.out.println("Cannot get a driver's license");
else
System.out.println("Can get a driver's license");
III:
if (age < 16)
System.out.println("Cannot get a driver's license");
else if (age >= 16)
System.out.println("Can get a driver's license");
IV:
if (age < 16)
System.out.println("Cannot get a driver's license");
else if (age > 16)
System.out.println("Can get a driver's license");
else if (age == 16)
System.out.println("Can get a driver's license");
```
a. I
b. II
c. III
d. IV
b. II
You might also like to view...
How many bytes does it take to represent a 1024x768 picture, a common screen size?
What will be an ideal response?
Within Active Directory, Windows servers can be either a(n) ____________________ or a domain controller.
Fill in the blank(s) with the appropriate word(s).
Define a variation on StringLinkedListSelfContained from Listing 12.7 that stores objects of type Employee, rather than objects of type String. Write a program that uses this linked-list class to create a linked list of Employee objects, asks the user to enter an employee’s social security number, and then searches the linked list and displays the data for the corresponding employee. If no such employee exists, display a message that says so. The user can enter more social security numbers until indicating an end to the program. The class Employee is described in Programming Project 6 of Chapter 9. If you have not already done that project, you will need to define the class Employee as described there.
What will be an ideal response?
Can the object type of an argument in the call to a method be difference from the object type of the corresponding formal parameter? Explain.
What will be an ideal response?