Register now or log in to join your professional community.
no, java not support method inside m ethod. we get compile time exception saying illigal start of expression.
anonymus class is a class that class does n't containt any name. we use it only for one time .
eg: new Thread(){
public void run(){
System.out.println("anonymus example prog");
}}.start();
no.we conn't define anonymus class inside inter face. becoz anonymus inner class contain some implemention and doesn't contain any name. we can define inner class.
we can define anonymus inner class inside class.
No, Java does not support "directly" nested methods. (Most functional languages do though, including some JVM languages such as Scala and Clojure!).
Anonymous class define inside of a method,that have no name is called anonymous Class.
No ,we cannot define Anonymous Class inside Interface . but we can define Inner Class.