首页 > 其他 > 详细

作业 刘惠惠

时间:2017-10-08 16:41:09      阅读:241      评论:0      收藏:0      [点我收藏+]
1输出一个长整型

public class Long
{
  public static void main(String[] args)
  {
  long l=123456789123;
    System.out.println("长整型变量为:"+l);
  }
}

技术分享

2输出一个单精度常量
public class Float
{
  public static void main(String[] args)
    {
      float f=(float)2.4;
      System.out.println("单精度常量:"+f);
    }
}

 

 技术分享

3输出一个布尔型

public class Boolean
{
  public static void main(String[] args)
  {
    boolean b=true;
    b=false;
    System.out.println("布尔型:"+b);
  }
}

 技术分享

4强制转换

public class Byte
{
  public static void main(String[] args)
    {
      byte b=3;
      b=(byte)(b+200);
      System.out.println("强制转换:"+b);
    }
}

 技术分享

5字符型加法运算
public class CharSum
{
  public static void main(String[] args)
    {
      System.out.println(‘a‘+1);
      System.out.println((char)(‘a‘+1));
      System.out.println((char)(‘你‘+1));
    }

}

 技术分享

6

public class Overflow
{
  public static void main(String[] args)
  {
    int big=0x7fffffff;
    System.out.println(big);
  }
}

 技术分享

7计算

public class SumChar
{
  public static void main(String[] args)
  {
    int x=20;
    x=x/2*100;
    System.out.println("得出:"+x);
  }
}

 

 技术分享

作业 刘惠惠

原文:http://www.cnblogs.com/huiiuh/p/7637716.html

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