In this section, you will learn to convert an integer type data into a float. The following programs helps you in converting an integer into a float type data.
Code Description:
This program takes an integer number at console and it converts into a float type data using the toString() method. This method specified the string value signed an integer which is converted into a float format.
toString(): This method converts an integer into a float and returns a float object.
Here is the code of this program:
import java.io.*;
|
Output this program.
| C:\corejava>java IntegerToFloat Enter a integer value! 24 Float:=24.0 C:\corejava> _ |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Convert Integer to Float View All Comments
Post your Comment