Computer forensics has absolutely nothing to do with prevention of hacking. Computer forensics would be the act of examining the computer in some form of investigation.
The best way to prevent being hacked is to use some common sense while using your computer. Things like using software from questionable sources or "cracked" software would put you at risk. Pretty much if you know you shouldn't be doing it, don't do it.
Get a robust firewall and keep it on, always. Install a reliable AV suite and keep it updated. Install a malware detector (pop-up blocker is good too) And never, every reply to phishing emails, use pirated or cheap copies of software, or visit dodgy sites.