一.String类 想要了解一个类,最好的办法就是看这个类的实现源代码,来看一下String类的源码: public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final char value[]; /** The offset is the first…
enum Season{ SPRING("spring","春暖花开"), SUMMER("summer","夏日炎炎"), AUTUMN("autumn","秋高气爽"), WINTER("winter","白雪皑皑"); } 其实上面等等同于: class Season{ Public static final Season SPRING =…
变量之间的类型转换主要包括自动类型转换和强制类型转换. 1.自动类型转换:当容量小的数据类型与容量大的数据类型做运算时,容量小的会自动的转换成容量大的类型. [知识点]: a)char,byte,short ---> int ---> long ---> float ---> double ---> String char c = 'a'; short s = 12; byte b = 125; //char.short和byte之间运算全部自动转换成int int s1 =…