Correct Answers 2026.
Consider the following code. Which line will not compile?
1. Object ob = new Object();
2. String[] stringarr = new String[50];
3. Float floater = new Float(3.14f);
4. ob = stringarr;
5. ob = stringarr[5];
6. floater = ob;
7. ob = floater;
A. Line 6
B. Line 4
C. Line 5
D. Line 7 - Answer A. Line 6
You have been given a design document for a veterinary registration system for implementation
in Java. It states:
"A pet has a owner, a registration date, and a vaccination-due dat. A cat is a pet that has a flag
indicating whether it has been neutered, and a textual decription of its marking."
Given that the Pet class has already been defined, which of the following fields would be
appropriate in the Cat class as members?
(Select the most appropriate two declarations)
A. Pet thePet;
B. Date vaccinationDue;
C. boolean neutered;
D. Date registered;
E. Cat theCat;
F. String markings; - Answer C. boolean neutered;
F. String markings;
Given:
10. public class ClassA {
11. public void count(int i) {