Question: Need assistance with a hw assignment. This needs to be done by the end of the week. Thank you for your help! What does a
Need assistance with a hw assignment. This needs to be done by the end of the week. Thank you for your help!
What does a Java import statement do?
Question 1 options:
| a. | It compiles all the classes in a package. |
| b. | It merges two classes. |
| c. | It allows a class name from a package to not be fully qualified. |
| d. | It defines a package |
Question 2 (1 point)
Which method is automatically called when an object is printed with System.out.println?
Question 2 options:
| a. | str |
| b. | toString |
| c. | to_string |
| d. | Object |
Question 3 (1 point)
Java code that could cause an exception can be put into a __________ block to prevent the exception from occurring by executing a catch block instead.
Question 3 options:
| a. | throw |
| b. | catch |
| c. | try |
| d. | finally |
Question 4 (1 point)
Which JUnit assert statement correctly checks whether the gender of the Person object p is 'F'?
Question 4 options:
| a. | assertEquals('F', p.getGender( )); |
| b. | assertEquals("Alice", p.getGender( )); |
| c. | assert("F", p.getGender); |
| d. | assertEquals('F', p.Gender( )); |
Question 5 (1 point)
Which method call returns a reference to the object stored at index 5 in the ArrayList collection col? a. col[5] b. col(5) *c. col.get(5) d. col.get[5]
Question 5 options:
| a. | col(5) |
| b. | col.get(5) |
| c. | col.get[5] |
| d. | col[5] |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
