Displacement method is based on principle of reversibility. The image distance for 1st position of lens will be same as object position with IInd position of lens.
\(u=-40 \,cm\)
\(V=+80 \,cm\)
\(\frac{1}{f}=\frac{1}{80}-\frac{1}{-40}\)
\(f=\frac{80}{3} \,cm\)