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

    }

  • 相关阅读:
    【漏洞分析】5次shift漏洞破解win7密码
    skyler实战渗透笔记(五)—Tr0ll
    skyler实战渗透笔记(四)—Raven2
    skyler实战渗透笔记(三)—Raven
    python读写excel文件
    python_列表
    mysql安装教程
    centos7安装RabbitMQ教程
    centos7安装mongodb4.2.15教程
    tomcat9安装教程
  • 原文地址:https://www.cnblogs.com/wangyang520/p/7640755.html
Copyright © 2011-2022 走看看