zoukankan      html  css  js  c++  java
  • long 和 int 的相互转换

    一.将long型转化为int型,这里的long型是基础类型:

    long   a = 10;     int b = (int)a;   

    二.将Long型转换为int 型的,这里的Long型是包装类型:

    Long a = 10; int b=a.intValue();

    三.将int型转化为long型,这里的int型是基础类型:

    int a = 10;long b = (int)a;

    四.将Integer型转化为long型,这里的Integer型是包装类型:

    int a = 10;Long b = a.longValue();

    总结:这里的转化就是要注意java的八种基础数据类型以及八种包装数据类型的区别。

    转:http://blog.csdn.net/u014039577/article/details/37925611

    谢!

    只有O和1的世界是简单的!
  • 相关阅读:
    python返回函数与匿名函数
    Session&Cookie
    write RE validation
    hello2 source anaylis
    Filter
    Development descriptor
    web.xml配置详解
    Annotation
    injector
    container
  • 原文地址:https://www.cnblogs.com/hinux/p/11088920.html
Copyright © 2011-2022 走看看