What is an Anonymous class

Anonymous class: It is a class formed without a class name. Such a class will be a sub class or an implementation of an interface, and is generally formed as an actual argument or returned as a method outcome. For example:

quitButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.exit(0);
}
});

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.