In common English, the term “hearsay” is used to refer to rumors and unsubstantiated information. In the legal community, this term has a specific meaning. It refers to evidence obtained through a second-hand source. Hearsay evidence is often not admissible in court, and there are strict rules about when such evidence will be allowed, which vary from nation to nation. If you've ever watched a legal drama and seen one of the lawyers leap up to say “objection: that's hearsay,” now you know what he or she was referring to.
Both senses have to do with getting information which cannot be verified from second or even third hand sources. A classic example of hearsay would be something like “my cousin saw the crime.” In this case, the cousin might well have seen the crime, but unless the cousin can be brought to court to testify, this evidence is treated as hearsay because it has not been verified by the person who actually witnessed the crime.
Many nations distinguish between the use of hearsay in criminal and civil trials. Criminal trials often have much stricter rules about the admission of evidence since the outcome of the trial could potentially be much more serious. In some countries, hearsay is allowed in civil trials, but not in criminal trials. This is designed to protect people who are defending themselves against charges of very serious crimes like murder.
Certain types of hearsay are admissible. For example, a birth certificate is technically an example of hearsay since it is a second-hand piece of information documenting someone's birth. However, it is treated as admissible evidence because it is a legal document and it may be difficult to track down the officials who were present at the birth. Other vital statistics and public records are also admissible as hearsay exceptions in nations where hearsay is not allowed at trial. Most nations have a clear list of exceptions to the hearsay rule which can be used to determine whether or not evidence is admissible.
Before a witness testifies in a trial, he or she usually meets with a lawyer who will walk the witness through what he or she can expect on the stand. The lawyer may discuss hearsay laws with the witness to make sure that he or she does not accidentally violate the hearsay rules. For example, if a doctor was subpoenaed to testify, he or she could repeat statements made in the process of arriving at a medical diagnosis, such as “I ate at [restaurant] and then felt ill,” but an average citizen would not be able to repeat such statements, because they would be considered hearsay from someone who was not a doctor.