Member variables and local variables can be distinguished in four ways.

The first aspect is: the definition position is different

A member variable is defined outside a method in a class.

Local variables are defined in methods within a class.

The second aspect is: different life cycles

Member variables are created with object creation and disappear with object destruction.

Local variables are generated as the method is pushed and disappear as the method is bounced.

The third aspect is: the initial values are different

Member variables have different initial values depending on the data type.

Local variables have no initial value and cannot be used without an assignment.

The fourth aspect is: different scope

Member variables can be used by all member methods in a class.

A local variable can only be used in the method in which it is defined.

Where is the definition? -> When? -> Is there a default value? -> Where can it be used?