Software Updates
You need to regularly check for, download and install updates to fix defects that are found in the software you are using.
Vulnerabilities
It seems it is not possible to develop any non-trivial software that is completely without any defects or flaws.
Some of these flaws and defects in software can be used to compromise system security, and allow a cracker to gain access to your computer. When such defects are discovered, software developers prepare fixes that can be downloaded and installed on your computer.
Patches
The fixes are typically made available as patches, which you can download and run to install the fix on your computer. Some systems have automatic update tools to regularly check for and install patches applicable to your system.
Many software developers run a mailing list to announce patches and security vulnerabilites.
Updates are usually free to download. Updates are typically only provided for the current version of the software, and perhaps the previous version or 2.
Other measures
On Windows systems, disable activeX and unhide filename extensions..
Most viruses target Internet Explorer and Outlook Express, so avoiding these products can improve your safety. Instead, you can try Firefox, Chrome, Opera, Thunderbird.