Overriding whats going on here?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Overriding whats going on here??

Machine m = new Machine() { @Override public void start() { System.out.println("Wooooo"); } };<<HERE m.start(); << HERE } }

20th Jul 2017, 8:56 PM
D_Stark - avatar
1 Answer
you are overriding the functions of the Machine class for the instance m m.start() is simply calling the start() function from the instance m
22nd Jul 2017, 4:28 PM
Kedar Kale
Kedar Kale - avatar