Yes, elastic net is always preferred over lasso & ridge regression because it solves the limitations of both methods, while also including each as special cases. So if the ridge or lasso solution is, indeed, the best, then any good model selection routine will identify that as part of the modeling process.
I strongly suggest reading the literature on these methods, starting with the original paper on the elastic net. The paper develops the intuition and the math, and is highly readable. Reproducing it here would only be to the detriment of the authors' explanation. But the high-level summary is that the elastic net is a convex sum of ridge and lasso penalties, so the objective function for a Gaussian error model looks like $$\text{Residual Mean Square Error}+\alpha \text{Ridge Penalty}+(1-\alpha)\text{LASSO Penalty}$$
for $\alpha\in[0,1].$
Hui Zou and Trevor Hastie. "Regularization and variable selection via the elastic net." J. R. Statstic. Soc., vol 67 (2005), Part 2., pp. 301-320.
Richard Hardy points out that this is developed in more detail in Hastie et al. "The Elemets of Statstical Learning" chapters 3 and 18.
However, in general, I've observed that your question history appears to ask a number of introductory-level questions on machine learning and statistics. This is fine; we welcome questions of all proficiency levels, but we do also ask that readers do some preliminary research and explain where they are getting stuck, or what they don't understand in specific terms.