Search This Blog

Wednesday 13 August 2014

Anonymous Inner Class in Java

/**
 *
 * Anonymous inner classes are defined and used once within a code block in java.
 */
public class MainClass {

public static void main(String[] args){
new Object(){ // name of the class from which new class will be extended. Object is super-dooper class of all classes.
public void testing(){
System.out.println("HI");
}
} .testing();
}
}

No comments:

Post a Comment