The problem with that type of testimony is that the attorneys are unable to question the person who provided the information that the witnesses is now talking about.
The reason why our judicial system works well is that the attorneys for both sides have an opportunity to question the veracity and test the statements by asking that person directly how they learned such information.
If an attorney does not have the opportunity to question someone who has critical information, and instead someone else comes into court and talks about with the original person said, that is considered hearsay.
However, just because something is hearsay does not mean that it will be kept out of evidence in all cases. There are specific limited exceptions in New York law may permit hearsay to come into evidence.