The 2N2222 is a common NPN bipolar junction transistor (BJT) used for general purpose low-power amplifying or switching applications.
JEDEC registered parameters include outline dimensions, small-signal current gain, transition frequency, maximum values for voltage withstand, current rating, power dissipation and temperature rating, and others, measured under standard test conditions.
NPN silicon transistors with similar properties are also made in a variety of small through-hole and surface mount packages including TO-92, SOT-23, and SOT-223.
The general specifications of the various variants are similar, with the biggest difference being the maximum allowable current and power dissipation.
They are not true replacements, but comparable devices that may be substituted only in circuits where the maximum current and voltage ratings are not exceeded.