Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Define a person, including name, gender, age and other information. All variables must be private. Other classes can only be obtained and modified by methods of this class.
Define a person, including name, gender, age and other information. All variables must be private. Other classes can only be obtained and modified by methods of this class.
The landlord made three mistakes.

1:the print () method is in the Ren Lei class, so you don't need a new Ren Lei () when calling Ren Lei's methods and properties in the print () method;

2: Name, gender and age are all static classes, so class name and attribute name Renlei.name should be used instead of object name and attribute name;

3. Age is plastic. Write 19 directly when plastic assignment is made. If double quotation marks are used, it is a string type.

Namely: renlei.age =19; However, since name, gender and age are private attributes of Ren Lei class, it is more logical for the landlord to remove the static nature of these three attributes.

Good luck to the landlord! ! !