A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Meteor in Action
this week in the
Java in General
valid and invalid declarations
Joined: Apr 26, 2007
May 02, 2007 05:28:00
Which of the following are not a valid declarations?
A1 float f = 1;
A2 float f = 1.2f;
A3 float f = 1.2;
A4 float f = (float)1.2;
In this case float f =1 is a valid declaration. Can any one help me why this declaraion is a valid declaration.
Joined: Mar 27, 2004
May 02, 2007 05:41:00
This is a Widening Primitive Conversion.
types can be implicitly converted to
. Please, check the following articles:
[ May 02, 2007: Message edited by: Leandro Melo ]
SCJP 1.4, SCWCD 1.4
I agree. Here's the link:
subject: valid and invalid declarations
"valid declarations of a float" required
Which are the valid declarations of Float?
About the data type
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015