java-interface

Java interface static method workaround?

We have a given REST interface: POST /calculation <data>abc</data> This calculation can be implemented by different logical "calculators" depending on the server config. We are now designing the Java interface that each calculator must implement. The interface will have a method for each REST service. Given that all REST (and H...

Java interfaces... Dynamic or static memory?

Where do java interfaces reside in memory? Do they reside in the heap or the stack, or maybe global memory? I am thinking the are in the stack since they are created at compile time. Am I correct? ...

Rewrite arrays using collections

I have a task, which I was able to do with the use of simplest methods - arrays. Now I'd like to go further and redo it using some more complicated java features like collections, but I've never used anything more complicated than 2d matrix. What should I look at and how to start with it. Should Tower become a Collection ? And here's the...

Passing Interface Class as a Parameter in Java

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 getti...