You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
have access to post topics
communicate privately with other members (PM)
not see advertisements between posts
have the possibility to earn one of our surprises if you are an active member
access many other special features that will be introduced later.
The default in java is that a primitive with a decimal in it is a double. For the lower precision float type we need to specify with a trailing "F", "f" or cast the value to float.
Same applies with int and long types using "L", "l" or long cast.
See paragraph 3 under the Literals header on Primitive Data Types.