Here are few of the techniques by which we can prevent hacking:
1. Update your OS and other software frequently
2. Download up-to-date security programs
3. Destroy all traces of your personal info on hardware you plan on selling
4. Do not use open Wi-Fi on your router
5. Remember your passwords
6. Practice smart emailing to avoid email Phishing
7. Keep sensitive data off the cloud