The study of the immune system, including how it functions to protect the body from infections and diseases.