Both have the ability to identify a wide array of intruders because each bears on its surface a unique receptor, one created by random combinations of relatively few components. Much as random choices from a restaurant menu can lead to meals with a huge number of variations, random combinations of components can lead, to trillions of different receptors. The human body thus has at least a trillion ways of recognizing that something foreign has invaded. The immune system recognizes invaders in a complex way. The two lymphocyte groups use different strategies.
B cells can attack the intruder directly.
T cells require assistance from B cells or other white blood cells that ingest and digest foreign invaders. Protein fragments from the processed invader reappear on the surface of these cells bound in specialized grooves of a complex of proteins. The T cell receptors recognize the bound protein complex and initiate a cascade of events, enlisting the B cell army as well as other T cells. This system allows lymphocytes to identify and destroy cells in which viruses or bacteria are hidden and multiplying. Normally, the trillion of lymphocytes do not attack their host.