About Question enthuware.ocajp.i.v7.2.1037 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
uqzma1xg
Posts: 6
Joined: Fri Jan 20, 2017 8:45 am
Contact:

About Question enthuware.ocajp.i.v7.2.1037 :

Post by uqzma1xg »

about answer D, how it's legal?
variable o3 might not have been initialized

Code: Select all

interface I1 { }
interface I2 { }
class C1 implements I1 { }
class C2 implements I2 { }
class C3 extends C1 implements I2 { }
C1 o1;
C2 o2;
C3 o3;
Which of these statements are legal?
  • Select 3 options
    A. class C4 extends C3 implements I1, I2 { }
    B. o3 = o1;
    C. o3 = o2;
    D. I1 i1 = o3; I2 i2 = (I2) i1;
    E. I1 b = o3;

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1037 :

Post by admin »

The question is only asking about legality of the assignments. You need to assume that there is no other issue involved. Otherwise, there is no class and no method given for the declarations of o1, o2, and o3. Nothing will compile.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests