Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Convert Float to float primitive example

  1. /*
  2.  * Convert Float to float primitive example. Program to convert Java
  3.  * Float object to float primitive data type.
  4.  */
  5.  
  6. public class FloatToFloatPrimitive {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   //new Float object
  11.   Float fObj = new Float("2.124");
  12.  
  13.   //to convert Float to float use floatValue method of Float wrapper class
  14.   float f = fObj.floatValue();
  15.  
  16.   System.out.println("Float converted to float: " + f);
  17.  
  18.  }
  19.  
  20. }
No votes yet
Share this

Post new comment