zoukankan      html  css  js  c++  java
  • 第三次作业 刘惠惠

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

     

  • 相关阅读:
    04:求整数的和与均值
    03:均值
    02:财务管理
    C8-3 三角形还是长方形? (100/100 分数)
    C8-2 圆的周长和面积 (100/100 分数)
    C8-1 复数加减乘除 (100/100 分数)
    C7-3 用类实现a+b (100/100 分数)
    C7-2 多继承 (100/100 分数)
    C7-1 账户类(100/100)
    数组第k小数
  • 原文地址:https://www.cnblogs.com/huiiuh/p/7637716.html
Copyright © 2011-2022 走看看