That's because a floating point literal, for example 42.0, is implicitly a Javadouble. So you would have to write float x = (float)42.0;
The letters f and d are used to denote the primitive types float and double respectively. So 42.0f is a literal of primitive type float, and 42.0d is a literal of primitive type double. [ October 25, 2004: Message edited by: Barry Gaunt ]
The format for storing floats and longs are significantly different. Because of this the range floats have a larger range than longs, even though floats use less bits. However, you can lose some precision using a float for larger numbers. For the specific maximum and minimum values for these primitive types, you can check out Long and Float in the Java API docs. The Java Language Spedcification also describes these details in all the gory detail.