Now, with a lot of resources available online, we don't need to attend offline courses to learn any technology. We can just enroll in an online course and you can learn from top instructors from anywhere in the world. So, it is better to enroll in an online course to learn Java that provides hands-on projects and certification.
I recommend this Java Training course that covers the basics of Java, Java statements, exception handling, Objects, Classes, understanding of JDBC, and so on. Also, you will get hands-on experience in implementing real-world projects, certification, and job assistance.
You can watch this video on Java Training to get started: