Java helps us creating anonymous object using
new class_name();
statement and calling the methods using association(.) operator like
new Emp().input();
How can I use it to invoke two methods simultaneously from an anonymous object like invoking both input()
and show()
together ?
or
public Emp show() {
// do the stuff
return this;
}
public Emp input() {
// do the stuff
return this;
}
Then call with
new Emp().show().input();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With