my dog learned polymorphism*
The moose likes Associate Certification (SCJA,OCAJ 5/6) and the fly likes In need of clarification of wording in an SCJA Mock question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Associate Certification (SCJA,OCAJ 5/6)
Bookmark "In need of clarification of wording in an SCJA Mock question." Watch "In need of clarification of wording in an SCJA Mock question." New topic
Author

In need of clarification of wording in an SCJA Mock question.

Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
Hi,

Going through a quick-fire test in a SCJA exam engine, I came across this statement:

This codecompiles without errors?



  • True -Exam answer:
  • False


  • -Exam description-The given code compiles correctly ,because it is a widening conversion from long to float and hence is allowed.



    Is it it not trying to convert float to long, are we not taking a float reference (f)and trying to assign it a long value,or am i mistaken, and its just a little badly worded?

    It does complile however!


    [ September 23, 2008: Message edited by: Stephen Davies ]

    be a well encapsulated person, don't expose your privates, unless you public void getWife()!
    patrick avery
    Ranch Hand

    Joined: Sep 12, 2008
    Posts: 46
    "Is it it not trying to convert float to long, are we not taking a float reference (f)and trying to assign it a long value,or am i mistaken, and its just a little badly worded? "

    My understanding is that the type of a reference cannot ever change, once declared, so in this case f is and will always be a float and contain only float values, so 12L MUST be converted to a float in order to get stuffed into f.

    So it seems, to me, that the Mock Test's verbiage of "widening conversion from long to float" is accurate.

    Thanks, Pat


    SCJA 96%
    SCJP 6 88%
    skipping SCJD to work on passing SCWCD
    Stephen Davies
    Ranch Hand

    Joined: Jul 23, 2008
    Posts: 352
    Pat,

    Thanks, that eases things, yes your right, but I still think they could have worded it a little better in their description!

    Steve
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: In need of clarification of wording in an SCJA Mock question.