A Java program has a class called Enrolment that stores information about a particular student's enrolment details.
The class has a Student object as one of its fields. The program designer has chosen to store the student ID as a field in both the Enrolment class and the Student class.
This is...
Question 10Answer
a.
Bad program design - it is an example of code duplication, which should be avoided.
b.
Necessary, as both the Enrolment and Student classes need to access this information.
c.
Good program design, as having the variable in two different places ensures it will be correct.
d.
Bad program design - it will cause a syntax error, as you can't declare the same field in two different classes.