java override during object creation

Viewed 10419

in the following java code a JButton is created but at the same time one of its methods gets overridden. Qestion: is there a name for overriding in this way while creating the object?

the code:

   JButton myButton;
   myButton = new JButton ("ok"){

        @Override
        public void setText(String text) {
            super.setText(text +", delete");
        }

the jbutton's label is now "ok, delete"

1 Answers
Related