Java基础知识 –狂神说笔记2(Basic knowledge of Java — crazy God’s Notes 2)

Java基础知识 –狂神说笔记2

  • 递归

    递归头:什么时候不调用自身方法。如果没有头,将陷入死循环。
    递归体:什么时候需要调用自身方法。

  • 递归头:什么时候不调用自身方法。如果没有头,将陷入死循环。
  • 递归体:什么时候需要调用自身方法。
  • 数组

    相同数据类型的有序集合
    数组声明:

    定义:int[] nums;
    赋值:nums = new int[10];

  • 相同数据类型的有序集合
  • 数组声明:

    定义:int[] nums;
    赋值:nums = new int[10];

  • 定义:int[] nums;
  • 赋值:nums = new int[10];
  • 面向对象

    类是对象的抽象,对象是类的具体实现

    new对象

    栈存放引用
    堆存放具体的对象

    封装

    属性私有,提供get set方法

    继承

    子类拥有父类的全部特性

    多态

    父类的引用指向子类的对象 Person p = new Student();
    instance of 如果匹配,可以进行类型之间的转换

  • 类是对象的抽象,对象是类的具体实现
  • new对象

    栈存放引用
    堆存放具体的对象

  • 栈存放引用
  • 堆存放具体的对象
  • 封装

    属性私有,提供get set方法

  • 属性私有,提供get set方法
  • 继承

    子类拥有父类的全部特性

  • 子类拥有父类的全部特性
  • 多态

    父类的引用指向子类的对象 Person p = new Student();
    instance of 如果匹配,可以进行类型之间的转换

  • 父类的引用指向子类的对象 Person p = new Student();
  • instance of 如果匹配,可以进行类型之间的转换
————————

Basic knowledge of Java — crazy God’s Notes 2

  • recursion
    Recursive header: when not to call its own method. If there is no head, it will fall into a dead cycle.
    Recursive body: when to call its own method.
  • Recursive header: when not to call its own method. If there is no head, it will fall into a dead cycle.
  • Recursive body: when to call its own method.
  • array
    An ordered collection of the same data type
    Array declaration:
    Definition: int [] num;
    Assignment: nums = New Int [10];
  • An ordered collection of the same data type
  • Array declaration:
    Definition: int [] num;
    Assignment: nums = New Int [10];
  • 定义:int[] nums;
  • 赋值:nums = new int[10];
  • object-oriented
    Class is the abstraction of object, and object is the concrete implementation of class
    New object
    Stack store reference
    The heap holds specific objects
    encapsulation
    Property is private, and the get set method is provided
    inherit
    A subclass has all the attributes of its parent class
    polymorphic
    The reference of the parent class points to the object of the child class, person P = new student();
    If instance of matches, you can convert between types
  • Class is the abstraction of object, and object is the concrete implementation of class
  • New object
    Stack store reference
    The heap holds specific objects
  • Stack store reference
  • The heap holds specific objects
  • encapsulation
    Property is private, and the get set method is provided
  • Property is private, and the get set method is provided
  • inherit
    A subclass has all the attributes of its parent class
  • A subclass has all the attributes of its parent class
  • polymorphic
    The reference of the parent class points to the object of the child class, person P = new student();
    If instance of matches, you can convert between types
  • 父类的引用指向子类的对象 Person p = new Student();
  • If instance of matches, you can convert between types