exam questions

Exam 1z0-851 All Questions

View all questions & answers for the 1z0-851 exam

Exam 1z0-851 topic 1 question 10 discussion

Actual exam question from Oracle's 1z0-851
Question #: 10
Topic #: 1
[All 1z0-851 Questions]

What is the result?
11. public class Person {
12. String name = "No name";
13. public Person(String nm) { name = nm; }
14. }
15.
16. public class Employee extends Person {
17. String empID = "0000";
18. public Employee(String id) { empID = id; }
19. }
20.
21. public class EmployeeTest {
22. public static void main(String[] args){
23. Employee e = new Employee("4321");
24. System.out.println(e.empID);
25. }
26. }

  • A. 4321
  • B. 0000
  • C. An exception is thrown at runtime.
  • D. Compilation fails because of an error in line 18.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️
Implicit super constructor Person() is undefined. Must explicitly invoke another constructor

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Currently there are no comments in this discussion, be the first to comment!
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...