aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes casting... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "casting..." Watch "casting..." New topic
Author

casting...

Preethi Dev
Ranch Hand

Joined: Sep 07, 2008
Posts: 265
Hi,this from Master exam.

class putter
{
public static void main(String args[])
{
Bango b1=new Bango();
Bango b2=new Bongo();
Bango b3=new Bingo();
//here
}
}

class Bango{}
class Bongo extends Bango{}
class Bingo extends Bongo{}

which code inserted here will not compile?
options:
A.Bongo b5=(Bongo)b2;
B.Bango b6=b3;
C.Bango b7=(Bango)b3;
D.Bingo b9=(Bingo)b3;
E.Bango b10=(Bongo)b3;

Answer given is A and E.
but when i tried all it compiles and runs without error ad exception.
please give me the correct answer.

Thanks
Preetha
Preethi Dev
Ranch Hand

Joined: Sep 07, 2008
Posts: 265
oops! sorry...options are wrongly typed
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14269
    
  21

There is an edit button to edit your post.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Jyothsna Panchagnula
Ranch Hand

Joined: Jul 11, 2005
Posts: 113
Hello Preetha,

Even I too ran the program. I dont see any compilation errors.

-Jyothsna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: casting...