Letter D is correct. C2 and I are not parent/child class to each other. Implicit casting will not work.
At least, we will need to explicitly cast
C2 s = (C2) obj2;
I t = (I) obj1;
even runtime objects are assignable to the references, but at compile time compiler refuse to compile, because there is not any IS-A relation between I and C2
Answer is D:
class C2 {
public void displayC2(){
System.out.println("C2");
}
}
interface I {
public void displayI();
}
class C1 extends C2 implements I {
public void displayI() {
System.out.println("C1");
}
}
public class Test {
public static void main(String[] args) {
C2 obj1 = new C1();
I obj2 = new C1();
C2 s = obj2;
I t = obj1;
t.displayI();
s.displayC2();
}
}
D. C2 and I are not parent/child class to each other. Implicit casting will not work.
At least, we will need to explicitly cast
C2 s = (C2) obj2;
I t = (I) obj1;
This section is not available anymore. Please use the main Exam Page.1z0-808 Exam Questions
Log in to ExamTopics
Sign in:
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.
pawankalyan
Highly Voted 4 years, 1 month agoakbiyik
Most Recent 7 months, 1 week agoiSnover
9 months, 1 week agoJongHwa
1 year, 7 months agoCapWin
2 years, 1 month agoSesha_2
2 years, 4 months agoTarik2190
2 years, 4 months agoBabirye
2 years, 9 months agoHarid
2 years, 10 months agov323rs
3 years, 5 months agoletmein2
3 years, 10 months agorasifer
4 years ago