单选题
适中
#4861
有如下程序段: class Student: count = 0 def __init__(self, name): self.name = name Stud…
有如下程序段:
class Student:
count = 0
def __init__(self, name):
self.name = name
Student.count += 1
def study(self):
print(f'{self.name}在学习')
student1 = Student("小明")
student2 = Student("小红")
student2.study()执行代码后,下列说法不正确的是?( )
答案与解析
正确答案:B
解析
程序创建了2个实例,Student.count的值为2。