showInfo() doesn't need to depend on Student, which can use other types of objects that also contain name and age (eg: Teacher) instead of binding specific implementation
EaserEasier to test : Pass required parameters only doesn't need to new a Student object first to test showInfo(),or we may replace Student with other objects that also has name and age such as Teacher at the calling client side, more likely a unit test instead of integration test
Looser coupling : Removing Student class doesn't require me to modify showInfo() to recompile
More reuseable showInfo() : I don't need to create another showInfo() method when I need another object (eg: I don't need to add
Became Hot Network Question