1. toString()来源 2. toString()目的 3. toString()实现(JDK8) 1. toString()来源 源于java.lang.Object类,源码如下: /** * Returns a string representation of the object. In general, the * {@code toString} method returns a string that * "textually represents" this ob…
一.包装类 java是一门面向对象的语言,秉承一切皆对象的思想. 可java中有一些基本数据类型并不是对象,有时可能需要将它们变为对象. 这时就需要用到我们的包装类了. 基本数据类型 包装类 int Integer char Character short Short long Long float Float double Double boolean Boolean byte Byte 通过对应的包装类可以让基本属性拥有对象的特性,之后可以使用相关的操作. public class Test…
一.基本类型包装类 1.基本类型包装类介绍 8种基本类型: byte short int long float double char boolean 这8种基本类型它们在程序仅仅只能规范某个空间的数据类型,并不能按照类的方式去操作这些类型. int a ; 在内存中需要开辟一个int类型的空间,空间名称为a 于是sun公司针对这8种基本类型提供了它们各自对应的类类型.把这些类型统一称为基本类型包装类. byte ------> Byte short --…
1.注解介绍 1.1注解的本质 Oracle官方对注解的定义为: Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate. 注解是元数据的一种形式,它提供有关程序的数据,该数据不属于程序本身. 注解…