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的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-26Mybatis官方生成器资料详解与应用教程
- 2024-11-26Mybatis一级缓存资料详解与实战教程
- 2024-11-26Mybatis一级缓存资料详解:新手快速入门
- 2024-11-26SpringBoot3+JDK17搭建后端资料详尽教程
- 2024-11-26Springboot单体架构搭建资料:新手入门教程
- 2024-11-26Springboot单体架构搭建资料详解与实战教程
- 2024-11-26Springboot框架资料:新手入门教程
- 2024-11-26Springboot企业级开发资料入门教程
- 2024-11-26SpringBoot企业级开发资料详解与实战教程
- 2024-11-26Springboot微服务资料:新手入门全攻略