answersLogoWhite

0

Is Float to float casting in java possible?

Updated: 8/17/2019
User Avatar

Wiki User

13y ago

Best Answer

It is possible in JDK 1.5 and above. In JDK 1.4, you also cast the Float value into float value by using casting.

For exampe in JDK 1.5, its possible

float f = 12;

Float ff = f;

but in JDK 1.4, you will use casting i.e

float f = 12;

Float ff = (float)f;

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is Float to float casting in java possible?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you change a float into a double using java?

with help of type casting it is possible


Is float is a keyword in java?

yes, float is keyword and data type in java


How do you declare an array of 8 floats?

In C float a[8]; In Java float a[] = new float[8];


Does java moss float?

Only if it's not charred.


What are two Java primitive types store floating-point numbers?

In Java, you can use either a float or a double


How to declare a float variable in java?

it is the same as an int, String, or any of the others:float myVar = 5.7f;If you try to assign a decimal number you must place an "f" at the end, otherwise Java will assume you are trying to assign a double.


Is float a data type in Java?

Yes it is but it is not usually used


What are java kaywords?

if ,while,do , int ,float, for,switch,else,


Can a double value be assigned to float variable?

THIS IS FOR JAVA i don't know about anything about other languages yes it can be assignedthe syntax is:int (number) = (float) numberFOR EXAMPLE:int = a;a = (float ) 5.5;if the (float) is not there then in Java it gives an error saying precision loss of data type


Why java is not a pure object oriented?

java is not purely oops because of primitive types in java like int and float double


Is this legal float f equals 2?

At least in Java, that's legal - 2 is treated as an int, which can be converted without problems to the float type.


Why do we use double in java but do not use float?

Double is more precise than float. The 4 bytes saved on a float are usually not very relevant. However, if you need to save large amounts of numbers (e.g. in an array), and you don't need the extra precision, you might save some memory by using float.