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.
A or B.
ReadJava Programing
Readhttp://ebook.com/ebook
Answer is D method read has private access modifier in class Book.java and both b1 and b2 are of reference type Book so compiler checks there first.
Yes MickB is right.
D. The Test.java file fails to compile.
D
D. is correct