In my java program, I have imported some java packages in one class. but in there 1 or 2 packages were crossed out.
Why that happened? How to solve this cross out to
Those classes are marked as @Deprecated.
This means that the compiler advises not to use them, because they can bring you problems.
A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code.
Check the javadoc(s) of the deprecated classes to check which classes to use instead.