One of the major problems with Java is that it doesn’t do a very good job of uninstalling old versions of itself when it updates. I’ve been on some client’s computers that have eleven different versions installed, going all the way back to version 1. This is bad. Java is the most exploited software out there, so having old versions installed is just asking for trouble.
First, I would recommend uninstalling Java completely if you don’t need it. If you don’t know whether or not you need it, then you probably don’t. You can always reinstall it later from the official website if you do. No harm done.
If you do need Java, then 1) make sure it stays updated, and 2) uninstall the old version if it doesn’t do it on its own. There’s no reason to have more than one on your computer. Oracle provides a tool to help you do this, but it requires that Java be enabled in your browser.
This will go a long way for security. A large portion of compromised computers I see are a direct result of outdated Java installations. But even if you have the latest version, stay on your toes and use good judgement when visiting websites. Even the latest versions have holes that can be exploited.