码迷,mamicode.com
首页 > 其他好文 > 详细

数据转换例子

时间:2017-07-13 13:31:05      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:技术分享   log   2.3   byte   images   com   默认   int   http   

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);
         }
}

技术分享

 

数据转换例子

标签:技术分享   log   2.3   byte   images   com   默认   int   http   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!