I would like to know if Java API has a built in shopping cart class which is readymade and ready to use.
of course it doesn't, and why should it?
There's so many different implementations depending on the requirements for the particular system under development that it would be completely impractical for Sun to provide any implementation, even if it were something that was commonly needed by the majority of users (which it isn't).
There are probably ready made solutions available for purchase from third parties, if they can fit (or be made to fit) in your systems.
I think JSP has that support, not sure.
JSP can be used to create the user interface for a shopping cart system, sure.
It does not contain a complete ready made shopping cart system though, cannot and should not contain such a system.
I would think a "ready made" shopping cart, would be something you purchase or something. Sort of like those crappy web editors that some schools use for teacher websites.