4. Given that $a$ and $b$ are non-zero constants, and $\frac{a^{2}}{\sin ^{2} \theta}+\frac{b^{2}}{\cos ^{2} \theta}=$ $(a+b)^{2}$. Then $\frac{a^{3}}{\sin ^{4} \theta}+\frac{b^{3}}{\cos ^{4} \theta}$ equals ( ).
( A ) $a^{3}+b^{3}$
(B) $(a+b)^{3}$
(C) $a^{2} b+a b^{2}$
(D) $a+b$
4.( B ).

Removing the denominator, we get
$$
\begin{array}{l}
a^{2} \cos ^{2} \theta+b^{2}\left(1-\cos ^{2} \theta\right) \\
=(a+b)^{2} \cos ^{2} \theta\left(1-\cos ^{2} \theta\right),
\end{array}
$$

which simplifies to $\left[(a+b) \cos ^{2} \theta-b\right]^{2}=0$.
However, $a+b \neq 0$ (otherwise, by the given equation, $a=b=0$, which contradicts the given information),
so $\cos ^{2} \theta=\frac{b}{a+b}$ and $\sin ^{2} \theta=\frac{a}{a+b}$.
Therefore, the original expression $=a(a+b)^{2}+b(a+b)^{2}=(a+b)^{3}$.