The programming language Java can be learned through online courses or free online tutorials. Java is widely used, and there are many resources available; these are just a few.
Java for the Absolute Beginner tutorials on Youtube, from The Java Hub: https://www.youtube.com/user/TheJavaHub
Code Academy offers a free introduction to Java (among other languages): https://www.codecademy.com/
The educational site Greenfoot offers a full range of free Java learning tools: http://www.greenfoot.org/
Khan Academy offers numerous Java-based sessions: https://www.khanacademy.org/computing/computer-programming
Edhesive offers a high school AP level Java course: https://edhesive.com/courses/apcs_java