The best way to learn how to program in Java is to find yourself some resources that can teach you the basics in a way that you'll stay engaged. I've found that trying to go through online "how-to" documentation that is published by the makers of any programming language can be very dry and doesn't really lead to learning anything unless you are extremely driven.
I have a website that's geared towards the beginner programmer (it focuses on the Java programming language) and is completely free. I've had an amazing amount of positive feedback from readers, and even some who say that this site is "the one they've been looking for".
If you're interested it can be found at http://howtoprogramwithjava.com
I also published an eBook and have started a video tutorial website, but those are both paid products and I would recommend starting with some free content to get your feet wet and see if programming is your cup of tea
Hope that helps and best of luck!