第27792题 单选题
针对以下定义的Student类,下列哪项是正确的类实例化操作?

已知如下Python类定义:

class Student:
    def __init__(self, name, age):
        self.stu_name = name
        self.stu_age = age
A

stu1 = Student(),未传入任何参数

B

stu1 = Student("Alice", 18),传入姓名和年龄参数

C

stu1 = Student.__init__("Bob", 2),直接调用init方法

D

stu1 = Student("Charlie"),仅传入姓名参数

程序运行统计
暂无判题统计
提交0次 正确率0.00%
答案解析