A transistor is a semiconductor device that can amplify or switch electronic signals and power by using a voltage or current applied to one pair of terminals to control the current through another pair of terminals. It is composed of semiconductor material with three terminals - the emitter, base, and collector. Transistors use a sandwich of p-type and n-type semiconductor materials and can be NPN or PNP types. They are commonly used in integrated circuits and have replaced vacuum tubes in most modern electronics due to being more durable, having a longer life, consuming less power, and not requiring a heating element.