Java基础资料整理

面向对象的三大基本特征和五大基本原则

https://segmentfault.com/a/1190000021898422

三大基本特征

  1. 封装
  2. 继承
  3. 多态

五大基本原则

  1. 单一职责原则

    核心思想:一个类,最好只做一件事,最好有且仅有一个引起它变化的原因。

  2. 开放封闭原则

    核心思想:一个类,可以扩展(添加属性和功能),但是不要修改已经写好的属性和方法。

    实现:抽象编程,而不对具体编程,因为抽象相对稳定。

  3. 里氏替换原则

    核心思想:子类必须能够替换其基类。

    实现:面向接口编程,将公共部分抽象为基类接口或抽象类,通过Extract Abstract Class,在子类中通过复写父类的方法实现新的方式支持同样的职责。

  4. 依赖倒置原则

    核心思想:依赖于抽象。具体而言,高层模块不依赖于底层模块,二者都同依赖于抽象;抽象不依赖于具体,具体依赖于抽象。

  5. 接口隔离原则

    核心思想:使用多个小的专门的接口,而不要使用一个大的总接口。

五大基本原则在实际应用中必定会有妥协,为他人所用,予他人便利,才是他们存在的意义。

基础知识

数据结构

  • Map和HashMap的区别: Map<K,V> is an interface, HashMap<K,V> is a class that implements Map

https://stackoverflow.com/questions/9588959/difference-between-hashmap-and-map-in-java/9588976

  • List和ArrayList的区别:List: The List is a child interface of Collection. It is an ordered collection of objects in which duplicate values can be stored. Since List preserves the insertion order, it allows positional access and insertion of elements. List interface is implemented by the classes of ArrayList, LinkedList, Vector and Stack. List is an interface, and the instances of List can be created by implementing various classes.

https://www.geeksforgeeks.org/difference-between-list-and-arraylist-in-java/

  • 数组ArrayList和链表LinkedList的复杂度

IntelliJ IDEA使用

  • 如何输入命令行参数

https://blog.csdn.net/HeatDeath/article/details/79102408

posted @ 2021-06-23 22:13  hawking8su  阅读(36)  评论(0编辑  收藏  举报