Hi all,

I have a simple question that I can't find the answer to

i'm using the following

Exam.java (interface)
ExamImpl.java (implementation)

ExamFactory.java (interface)
ExamFactoryImpl.java (implementation)

The ExamFactory interface says the newExam() method return type is "Exam"
The ExamFactoryImpl code currently returns "ExamImpl"

Is this a problem??
i.e. Are Exam and its implementation the same thing??

public interface ExamFactory extends java.rmi.Remote {
	public Exam newExam(String examName) throws RemoteException;
	public Exam getExam(String examName) throws RemoteException;
// ExamFactoryImpl.java
public ExamImpl newExam(String exam_name) {		// Asks factory for new exam
		ExamImpl exam = new ExamImpl(exam_name);
		return exam;



Are Exam and its implementation the same thing??

No, but in this case the method is defined as returning an Exam. Because Exam is an interface you cannot instantiate one directly. If ExamImpl implements Exam then this is a class that you can instantiate, and any instance of it will also be an Exam, so it is valid to return an instance of ExamImpl where the return type is defined as Exam.