I have one class named Sample which is used in my code like below:
class Sample{
.
.
Object someMethod(){
return someObject;
}
.
.
}
I call itlike:
Object ob = new Sample().someMethod();
I want to know if there is any advantage if I create anonymous ``Objectof any class (new Sample()) and call anyrequiremethod if I don't have any further use of thisObject`.