It's possible to hack an online wallet, but it's almost impossible to hack a wallet installed on your computer if you have also installed up to date antivirus software and a firewall. If you control your Bitcoin private key generated by your wallet installed on your computer then your Bitcoins cannot be stolen by directly hacking your Bitcoin wallet. The only way your Bitcoins stored on your computer can be stolen is if your computer gets hacked, or infected with a virus.
Online wallets are sometimes hacked, but whoever runs the online wallet controls your Bitcoins, and how secure the wallet is depends on their coding skills.
If an online wallet is hacked that doesn't mean that you can loose for sure your bitcoins. Depends in which online wallet they are stored. I use Coinbase and this wallet keep up to 97% of customer funds stored offline. So even if hacked the hacker will have almost nothing (if will have the possibility or the chance to find those 3% bitcoin remain online). This is the first thing. The second is that no one from the part of wallet (employee, manager, owner or whatever it will the human kind which work with Coinbase) have no possibility to touch my bitcoins. According to Coinbase Blog of October 29, 2014 with the title "Introducing Multisig Vault - You Can Now Control Your Own Private Keys On Coinbase":
"Our new Multisig Vault gives the customer complete control of their own private keys. Coinbase has no ability to move funds (which means you are safe from Coinbase being hacked, going bankrupt, or anyone seizing your bitcoin). It also means that you as a customer have much greater responsibility in storing your backup key securely. If you lose this backup and forget your multisig password, Coinbase cannot help you recover your bitcoin. For this reason, we only recommend this feature for advanced users."
I don't use this Multisig because I am not an advanced user. But even the hacking of the wallet itself is very hard to be made. In my account can be entered only after the put of the code which come to my phone or to my account at Authy (which have my phone number). So it is not very easy. It is not at all easy. But this is not all. Bitcoin stored on their servers is covered by their insurance policy. According to their site:
"Coinbase is insured against employee theft and hacking in an amount that exceeds the average value of online bitcoin it holds at any given time. Specifically, Coinbase's insurance policy would respond in the event that bitcoin stored in Coinbase was lost or stolen as a result of a breach of our physical security, cyber security, or as a result of employee theft."
"Coinbase has held this insurance since November 2013 with highly rated carriers (S&P rating of A+ or A.M. Best Rating of A XV or higher)."