exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 119 discussion

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

Given:

And given the code fragment:

What is the result?

  • A. C2C2
  • B. C1C2
  • C. C1C1
  • D. Compilation fails
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
pawankalyan
Highly Voted 3 years, 6 months ago
D is correct
upvoted 13 times
...
akbiyik
Most Recent 1 week, 4 days ago
Selected Answer: D
D is correct. incompatible types: I cannot be converted to C2 incompatible types: C2 cannot be converted to I
upvoted 2 times
...
iSnover
2 months ago
Selected Answer: D
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;
upvoted 2 times
...
JongHwa
1 year ago
Selected Answer: D
D is correct. tested
upvoted 1 times
...
CapWin
1 year, 6 months ago
D is correct. For this code to compile, C1 need to define the abstract method inherited from I (interface class).
upvoted 3 times
...
Sesha_2
1 year, 9 months ago
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
upvoted 1 times
...
Tarik2190
1 year, 10 months ago
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(); } }
upvoted 2 times
...
Babirye
2 years, 2 months ago
B is correct.
upvoted 1 times
...
Harid
2 years, 3 months ago
The answer is D - Compile Error, but if the casting was done correctly then answer would be B - C1 C2
upvoted 1 times
...
v323rs
2 years, 11 months ago
The correct answer is D Compilation fails
upvoted 2 times
...
letmein2
3 years, 3 months ago
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;
upvoted 4 times
...
rasifer
3 years, 5 months ago
Answer is D, tested.
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