Search Results

Search found 1 results on 1 pages for 'aleclerc'.

Page 1/1 | 1 

  • Passing Interface Class as a Parameter in Java

    - by aleclerc
    I have an interface: public interface IMech { } and a class that implements it public class Email implements IMech { } and a third class that has this method implemented: public void sendNotification( Class< IMech > mechanism ){ } now I'm trying to call that method like so foo.sendNotification(Email.class); but i keep getting an exception saying: The method sendNotification(Class<IMechanism>) in the type RemediationOperator is not applicable for the arguments (Class<EmailNotification>) Shouldn't this work if it interfaces that class?

    Read the article

1