1. Objects have behavior, state, and identity.
2. The character set used by the java language: Unicode character set , which has 65535 bytes and can represent any character.
3. Identifier
Definition: A sequence of characters consisting of letters, numbers, underscores, $ and other characters.
Function: used to represent variable names, method names, class names, interface names, etc.
Rules:
> Cannot start with a number > Can contain numbers, letters, currency symbols, Chinese characters, etc. > The length is not limited, but it is best not to be too long > Cannot contain Spaces, semicolons, commas, single quotes, double quotes, etc. > java keywords (reserved words) cannot be used as identifiers
4. Three major characteristics of java: inheritance, encapsulation, and polymorphism
Inherit
About inheritance:
> Improve code reusability;
> Class is the abstraction of objects, inheritance is the abstraction of a certain group of classes, so as to achieve better modeling of the real world > Keyword extends> There is only single inheritance in java (only one direct parent class), avoiding the complexity of multiple inheritance in c++,
Multiple inheritance can be achieved by implementing interfaces.
> In addition to inheritance, composition can also achieve code reuse, but from a modeling perspective, inheritance is an is-a relationship, and composition is a has a relationship.
However, try to use combination to generate new types in code design, otherwise too much use of inheritance will make code design too complicated.
Inheritance breaks encapsulationpackage
Purpose : High cohesion, low coupling
> High cohesion----- The internal data operation details are completed by themselves, and external interference is not allowed
> Low coupling---- only expose a small number of methods for external use
Packaging points:
> All general member variables use private modification, constant or static modified class variables, use public
> Provide the corresponding set/get method to access the corresponding attribute, (the get method of the boolean variable starts with is)
> Auxiliary classes in this class, use private
polymorphism
About polymorphism:
5. this and super
In ordinary methods , this and super are implicitly passed as parameters, that is, the current object reference and the direct parent object reference ;