Yes. Its possible. You can have multiple methods in anonymous inner class. Check the below example.
interface myInterface {
void welcome(String string);
void test();
}
public class innerClassTest {
public static void main(String[] args) {
myInterface obj = new myInterface() {
public void welcome(String string) {
System.out.println("welcome method");
}
public void test() {
System.out.println("test method");
}
};
obj.welcome("hi");
obj.test();
}
}
Can i get more info.