集册 Java实例教程 Java Float包装器类

Java Float包装器类

欢马劈雪     最近更新时间:2020-01-02 10:19:05

586
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
Java Float包装器类
/*
来 自*
 nowjava - 时  代  Java
*/


 

public class Main {

 

  public static void main(String[] args) {

    //create a Float object using one of the below given constructors

   

    //1. Create an Float object from float primitive type

    float f = 10.10f;

    Float fObj1 = new Float(f);

    System.out.println(fObj1);

   

    //2. Create an Float object from double primitive type

    double d = 10.10;

    Float fObj2 = new Float(d);

    System.out.println(fObj2);

   

    
展开阅读全文