tags:

views:

128

answers:

2

Itest is an Interface. here i mentioned like new Itest(). Then is it means that i can create object for interface?

public interface Itest {


}
static final Itest s = new Itest(){
}; 

It is just like, we could create object for interface without any class implement the interface.

+1  A: 

It sounds like what you are looking for is anonymous classes.

They are most commonly used something like this:

interface Something { void execute(); }

// In some code...
setSomething(new Something() {
   public void execute() { 
       // Your code here
   }
});
Phill Sacre
A: 

If you are testing you need mocking. Look for a mocking library as jMock.

onof