Concept:
Basicity of amines depends upon the availability of the lone pair of electrons on nitrogen for donation.
Factors affecting basicity:
• \(+I\) effect of alkyl groups increases electron density on nitrogen.
• Resonance delocalization decreases availability of lone pair.
• Solvation effects also influence stability.
Step 1: Compare aliphatic amines with ammonia.
Alkyl groups donate electrons due to the inductive effect.
Thus:
\[
\text{Dimethylamine} > \text{Methylamine} > \text{Ammonia}
\]
because dimethylamine has two electron-releasing methyl groups.
Step 2: Analyze aniline.
In aniline:
\[
\text{C}_6\text{H}_5\text{NH}_2
\]
The lone pair on nitrogen participates in resonance with the benzene ring:
\[
\text{N lone pair} \rightarrow \text{benzene ring}
\]
Hence the lone pair becomes less available for protonation.
Therefore, aniline is less basic than ammonia.
Step 3: Final order.
Combining all effects:
\[
\boxed{\text{Dimethylamine} > \text{Methylamine} > \text{Ammonia} > \text{Aniline}}
\]