What is the difference between a static method and class method in Python?

What is the main difference between interface and anonymous inner class in Java?

  • This description has been edited by another user. interface Hello { void show(); } class Demo implements Hello { void show() { System.out.println("i am in method of Demo class"); this.call(); } Hello h= new Hello() { public void show() { System.out.println("i am in method of anonymous class"); } //}; void call() { System.out.println("i am in call"); h.show(); } }; class AnyDemo { public static void main(String[] args) { Demo d= new Demo(); d.show(); }

  • Answer:

    Anonymous classes are that they enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name. Use them if you need to use a local class only once. Interfaces are opposite to anonymous classes where declaration and instantiation are not done at same time. You can take a look at below link for further information about anonymous classes http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html

Anvitha Tunikuntla at Quora Visit the source

Was this solution helpful to you?

Other answers

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.