zoukankan      html  css  js  c++  java
  • 练习

    public class Long
    {
       public static void main(String[] args)
          {
          long l=123456789012345l;//java中默认类型为Int型,电脑想要识别长整型需加l(或L)
          System.out.println(l);
           }

    2、输出一个单精度的小数常量

    public class Float
    {
       public static void main(String[] args)
       {  
          float f=2.4f;//小数默认为double型
          System.out.println(f);
       }

    3、输出一个布尔类型的变量

     public class L { 

    boolean c=true;            
            System.out.println(c);

            c=false;

            System.out.println(c);       

    }   

     4、强制类型转换

    public class Byte
    {
       public static void main(String[] args)
       {
          byte b=5;  //b为byte类型
          b=(byte)(b+200); //200为Int类型,与b类型不一致,要强制转换
          System.out.println(b);
       }

       }

     

    5、输出字符型的加法计算

    public class T{
       public static void main(String[] args)
       {
            System.out.println((char)('a'+1));
            System.out.println((char)('你'+1));
       }

    }

  • 相关阅读:
    算法很美(一)
    pytest学习(四)
    pytest学习(三)
    pytest学习(二)
    pytest学习(一)
    HTTP协议详细介绍,面试详全强助攻!
    Docker实战总结
    微信小程序测试整理
    这些用例设计题,你在面试时遇到过吗?
    测试面试题集-Dubbo常见面试题(12)
  • 原文地址:https://www.cnblogs.com/wangyang520/p/7640755.html
Copyright © 2011-2022 走看看