exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 146 discussion

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

Given the code fragments:

What is the result?

  • A. Compilation fails only at line n1.
  • B. Compilation fails only at line n2.
  • C. Tool::export Tool::export
  • D. Compilation fails at both line n1 and line2.
  • E. RTool::export Tool::export
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
MPignaProTech
2 months, 3 weeks ago
Selected Answer: B
default -> public is OK public -> default is not OK.
upvoted 1 times
...
akbiyik
2 years, 1 month ago
Selected Answer: B
Answer is B.
upvoted 1 times
...
carloswork
2 years, 2 months ago
Selected Answer: B
Answer is B. "You cannot reducing de visibility of the method export, in class ReportTool." To test: interface Exportable { void export(); } class Tool implements Exportable { public void export () { // line n1 System.out.println("Tool::export"); } } class ReportTool extends Tool { void export() { // line n2 System.out.println("Tool::export"); } public static void main(String[] args) { Tool aTool = new ReportTool(); Tool bTool = new Tool(); callExport(aTool); callExport(bTool); } public static void callExport(Exportable ex ) { ex.export(); } }
upvoted 1 times
...
iSnover
2 years, 3 months ago
Selected Answer: B
The answer is letter B. N1 -> Any method by default inside an interface (Even without evidence) is public. Already in a class that implements an interface the public has to be put, because a method that was inherited cannot have a lower range, as put public it compiles. N2 -> It doesn't compile, because as the method was not put public, it has its visibility in default because it is inside a class and the default visibility is lower than the public of the interface, making the code not compile.
upvoted 1 times
...
shivkumarx
2 years, 4 months ago
Answer is B n1 is fine as the interface method is assumed public n2 attempts to reduce visibility
upvoted 2 times
...
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago