exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 81 discussion

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

Given:
Book.java:
public class Book {
private String read(String bname) { return "Read" + bname }
}
EBook.java:
public class EBook extends Book {
public class String read (String url) { return "View" + url }
}
Test.java:
public class Test {
public static void main (String[] args) {
Book b1 = new Book();
b1.read("Java Programing");
Book b2 = new EBook();
b2.read("http://ebook.com/ebook");
}
}
What is the result?

  • A. Read Java Programming View http:/ ebook.com/ebook
  • B. Read Java Programming Read http:/ ebook.com/ebook
  • C. The EBook.java file fails to compile.
  • D. The Test.java file fails to compile.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
Innovation
Highly Voted 5 years ago
we cant call b1.read() from outside the class Book because it is private the code does not compile
upvoted 6 times
...
vidhuharu
Most Recent 3 months, 2 weeks ago
Selected Answer: D
test class cant access other class private method
upvoted 1 times
...
asdfjhfgjuaDCV
10 months, 2 weeks ago
Answer is D if Class is not there in ebook else C
upvoted 1 times
...
steefaand
11 months, 2 weeks ago
Selected Answer: C
Given this code is correctly typed, answer is C since it contains line: public class String read If class is not there then answer is D since read method is private and can't be called from outside of class.
upvoted 1 times
...
Samriddji
3 years, 1 month ago
D tested. If the few typos are removed. In Ebook.java replace "public class String read (String url) { return "View" + url }" with "public String read (String url) { return "View" + url; }"
upvoted 2 times
...
Svetleto13
3 years, 7 months ago
If typo is corrected then answer should be D. public String read (String url)
upvoted 1 times
...
jduarte
3 years, 9 months ago
Answer is C because public class String read (String url) { return "View" + url } not compile. If clear String in read then the answer is D because b1.read() can´t to access
upvoted 2 times
...
thetech
5 years, 1 month ago
Answer is C. Tested.
upvoted 1 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