Composition of classes

1. Attributes
(1) Attributes are also called member variables.

(2) Syntax: data type variable names;

(3) Definition location: within the class, but outside the method.

2. Method
(1) Method is also called member method.

(2) Define the method name of public return value type(parameter list){//Method implementation}

(3) Note that static is not added when defining the method here.

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐