Java - Classes and Objects
Find the error in this Java class:
class Student {
String name;
void Student(String n) {
name = n;
}
}class Student {
String name;
void Student(String n) {
name = n;
}
}void Student(String n) looks like a constructor but has void return type, so it's a regular method, not a constructor.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions