zoukankan      html  css  js  c++  java
  • 【JAVA基础】常量

    常量:在程序运行期间,固定不变的量

    常量分类:

    1.字符串常量:凡是用双引号引起来的部分,叫字符串常量,例如"AC","123"

    2.整数常量:没有小数点的数字 如123

    3.浮点数常量:有小数点的数字 如0.0 ,123.3

    4.字符常量:凡是用单引号引起来的单个字符,叫字符常量 '3','A','中'

    5.布尔常量:true,false

    6.空常量: null   (代表没有任何数据)

    public class Demo01Const{
    	public static void main(String[] args)
    	{
    		//字符串常
    		System.out.println("ABC");
    		System.out.println("");// 表示内容为空
    		System.out.println("123");
    		
    		//整数常量
    		System.out.println(123);
    		System.out.println(-12);
    		
    		//浮点型常量
    		System.out.println(3.14);
    		System.out.println(0.0);
    		
    		//布尔型常量
    		System.out.println(true);
    		System.out.println(false);
    		
    		//字符常量
    		System.out.println('A');
    		System.out.println('6');
    		/////System.out.println(''); //两个单引号中间必须有且仅有一个字符,没有不行
    		
    		//空常量
    		////System.out.println(null);//空常量不能直接用来打印输出
    		
    	}
    }
    

      

  • 相关阅读:
    去哪儿网门票数据爬虫更新
    每周进度总结12
    每日进度总结20
    每日进度总结19
    每日进度总结18
    每日进度总结17
    每日进度总结16
    每日进度总结15
    每日进度总结14
    每周进度总结11
  • 原文地址:https://www.cnblogs.com/paulwinflo/p/12708823.html
Copyright © 2011-2022 走看看