I think the best approach is to create a class Class from whom ClassWork and ClassExam inherit.
The father class ClassF would declare those general attributes and the other 2 subclasses only will have to declare those specific attributes that make them unique 'cause the general ones are implied by inheritance.
I'll try to explain with an example:
ClassF -> attributes: name, ID, weight, Date
-> methods: getName() ....
Exam -> attributes: marks
-> methods: calculateMarks()...
CourseWork -> attributes: typeOfCourse
-> methods: printInfoCourse()...
The subclasses Exam and CourseWork could implement and use for example, ID from ClassF because it's inherited from its father class.
Maybe it is a good idea to decide if you want to allow the instantiation of ClassF or not, because in that case it would be interesting to transform ClassF into an abstract class..
Just for the record in this concrete case the use of an interface to implement those classes is a wrong approach because that is not the function of an interface (https://docs.oracle.com/javase/tutorial/java/concepts/interface.html for more info)
Hope it helps!