在Java中,以下代码片段中,如何正确初始化Student类的实例? A. Student s = new Student(name: "Melon", age: 19); B. Student s = new Student("Melon", 19); C. Student s = new Student(); s.name = "Melon"; s.age = 19; D. Student s = Student(name: "Melon", age: 19); 答案解析 在Java中,构造器调用时不需要使用参数名,直接按照构造器定义的参数顺序传递值即可。因此,选项B是正确的初始化方式。 正确答案:B