·
Given:
Which of the following statements is correct about a FileWriter?
- A. Compilation fails on line 1
- B. Compilation fails on line 2
- C. Compilation fails on line 3
- D. Compilation fails on line 4
- E. Compilation fails on line 5
- F. Compilation succeeds
#java #certificationquestion #ocp
The String type variable in class Person is a type parameter and meaningful only within that class - it isn't the String class in the java.lang package.
We can only call methods defined in the java.lang.object class on an instance of that String type.
The toUpperCase method is declared in the java.lang.String class, not the java.lang.Object
Therefore, the compiler fails on line 3.
·ꓛ sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥʇ :uoᴉsnʅɔuoꓛ