A witness will be asked to tell the court only what she or he saw or heard, not what someone else told the witness had occurred. This is hearsay evidence.
For example, a witness can say 'I saw Jill push Jack down the hill' but cannot say 'I wasn't there at the time, but Tom Piper told me that he saw Jill push Jack down the hill'.
Whether a particular piece of evidence is hearsay or not is often a difficult question to answer, as this is a complex area of law and there are many exceptions to the general rule.