We consider the differential equations y'' = λ0(x)y' + s0(x)y, where λ0(x), s0(x) are C∞-functions. We prove (i) if the differential equation has a polynomial solution of degree n > 0, then δn = λnsn−1 − λn−1sn = 0, where λn = λ'n−1 + sn−1 + λ0λn−1andsn = s'n−1 + s0λk−1, n = 1, 2, .... Conversely (ii) if λnλn−1 ≠ 0 and δn = 0, then the differential equation has a polynomial solution of degree at most n. We show that the classical differential equations of Laguerre, Hermite, Legendre, Jacobi, Chebyshev (first and second kinds), Gegenbauer and the Hypergeometric type, etc obey this criterion. Further, we find the polynomial solutions for the generalized Hermite, Laguerre, Legendre and Chebyshev differential equations.