If inductor can store energy why not a current carrying wire? My book says that an inductor produces magnetic field around it and it stores energy in this field but then i thought a current carrying wire also produces magnetic field around it then why does it not store energy ? And if it does then why do we use inductors ?
 A: A straight wire carrying a current does indeed store energy in a magnetic field so it does have an inductance. For example see Derivation of self-inductance of a long wire.
However the inductance of a straight wire is very small. Coiling the wire into a solenoid allows you to create a circuit element with a large inductance for a small size.
The inductance of a straight wire is given by:
$$ L_\text{wire} = \frac{\mu\ell}{8\pi} \tag{1}$$
The inductance of a coiled wire is normally written in the form:
$$ L_\text{coil} = \frac{\mu N^2 A}{d} $$
where $N$ is the number of turns in the coil, $A$ is the area of the coil and $d$ is the length of the coil. To compare this with equation (1) we note that $A=C^2/4\pi$ where $C$ is the circumference, and $NC$ is the total length of the wire. Substituting this into the equation above gives:
$$ L_\text{coil} = \frac{\mu \ell^2}{4\pi d} \tag{2} $$
Or we for comparison with equation (1) we could use $\ell=N2\pi r$ to rewrite this as:
$$ L_\text{coil} = \frac{\mu \ell}{2}\frac{Nr}{d} \tag{3} $$
