文章目录
Interface
-
interface variables
interface do not allow instance variables. Only allow static final variables shared by all the instances.
Abstract Class
性质
- cannot new a object from a abstract class, constructor of abstract class should be protected
- abstract class could have a constructor, when you call sub class’s constructor, jvm will call super class constructor implicitly
- abstract class的field不可以是final, 不可以使用@Data or @Value,如果用builder,需要在super class和sub class用@SuperBuilder
- 什么时候用abstract class呢?当很多class有shared code的时候
super keyword
利用super,来call abstract class的fields(一般就是hard coded的field), function以及constructor
https://www.javatpoint.com/super-keyword
Why constructor in abstract class
https://stackoverflow.com/questions/2170500/why-do-abstract-classes-in-java-have-constructors
Static Class
只用在nested class里面
https://caveofprogramming.com/java/java-static-class-tutorial.html#:~:text=Static%20classes%20are%20basically%20a,static%20inner%20class%20called%20Wheel.
Stream
Naming
https://stackoverflow.com/questions/6861671/abstract-class-naming-convention
Interface B
abstract AbstractB
access modifier
https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
泛型
泛型及其重要性
T和?的区别
大白话
array和generic并不兼容
class aaa 定义这个class可以用泛型
class bbb extends aaa 定义泛型具体是什么