How to Protect Yourself from Viruses and Hackers?

There are lots of viruses and hackers in today's technology world. That is why the question of how to protect yourself from them is important.