首页 > 其他 > 详细

数据转换例子

时间:2017-07-13 13:15:50      阅读:248      评论:0      收藏:0      [点我收藏+]

public  class  Shujuzhuanhuan2

{

        public static void main(String[] args)

        {

                   //byte的取值范围: -128~127

                   byte b=200;

                   System.out.println(b);

         }

}

技术分享

 

public  class  Shujuzhuanhuan2

{

        public static void main(String[] args)

        {

                   //byte的取值范围: -128~127

                   byte b=(byte)200;

                   System.out.println(b);

         }

}

技术分享

public class Shujuzhuanhuan2
{
         public static void main(String[] args)
        {
                short s=123;
                int i=50000;
                s=i;
                System.out.println(s);
         }
}

技术分享

public class Shujuzhuanhuan2
{
         public static void main(String[] args) 
        {
                short s=123;
                int i=50000;
                s=i;
                System.out.println(s);
         }
}

 技术分享

public class Shujuzhuanhuan2
{
         public static void main(String[] args) 
        {
                long l=123456;

                long l2=8888888888;

                System.out.println(l2);
         }
}

 技术分享

public class Shujuzhuanhuan2
{
         public static void main(String[] args) 
        {
                long l=123456;

                long l2=8888888888L;

                System.out.println(l2);
         }
}

8888888888的数据类型默认为int型,数据超出int数据类型的长度。

技术分享

public class Shujuzhuanhuan2
{
         public static void main(String[] args) 
        {
                float f=12.345;

                System.out.println(f);
         }
}

技术分享

public class Shujuzhuanhuan2
{
         public static void main(String[] args) 
        {
               float f=12.345f;

                System.out.println(f);
         }
}

技术分享

 

数据转换例子

原文:http://www.cnblogs.com/jgjk/p/7159804.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!