aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Implict Cast Narrowing Doubts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Implict Cast Narrowing Doubts" Watch "Implict Cast Narrowing Doubts" New topic
Author

Implict Cast Narrowing Doubts

Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
From web page


I know at line 3,it will have compiler error.
Why at line 6 is not given the compiler error...
float is 32 bit and long is 64 bit
so it's narrowing anf for for narrowing the implicit cat will work if the assigned value is compiler time constant..
But above the float l is assigned a run time value..then why it is not given error.. pls clarify


Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
Bob CHOI
Ranch Hand

Joined: Nov 10, 2006
Posts: 127

Compilation error "loss of precision" on the last 2 lines, not any above! ???


Hard work rewards
Tommaso Nuccio
Ranch Hand

Joined: Dec 11, 2006
Posts: 66
Hi,

the last two lines are assignments, while the others before are simply modifications of the value itself.


Ciao,<br /> Tommaso<br /> <br />~*~*~*~<br />There are 10 types of people, those who understand binary and those who don't.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Implict Cast Narrowing Doubts