java基础总结——基本数据类型、final、static

2022/5/3 14:14:09

本文主要是介绍java基础总结——基本数据类型、final、static,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 

 

 

==============================================

 

public class Helllo
{
    static boolean bool;
    static byte by;
    static char ch;
    static double d;
    static float f;
    static int i;
    static long l;
    static short sh;
    static String str;



    final int a;

    public Helllo() {
        a = 0;
    }

    final double PI = 3.1415927;



    public static void main(String[] args)
    {
        System.out.println("Bool :" + bool);
        System.out.println("Byte :" + by);
        System.out.println("Character:" + ch);
        System.out.println("Double :" + d);
        System.out.println("Float :" + f);
        System.out.println("Integer :" + i);
        System.out.println("Long :" + l);
        System.out.println("Short :" + sh);
        System.out.println("String :" + str);
        System.out.println("---------------------------------");
        bool = true;
        System.out.println("Bool :" + bool);
        System.out.println("---------------------------------");
        System.out.println(new Helllo().a);
        System.out.println("---------------------------------");


    }
}

  

 

执行结果:

 

Bool :false
Byte :0
Character: 
Double :0.0
Float :0.0
Integer :0
Long :0
Short :0
String :null
---------------------------------
Bool :true
---------------------------------
0
---------------------------------

  

 

 

 

 

 

 

===============================================

 

 

 

 

===================================================================================

 

 

 



这篇关于java基础总结——基本数据类型、final、static的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程