Hey, that's almost funny.
The real truth is that the only reason that Apple's operating systems has been regarded as far more secure than Windows is because hacking is a numbers game, one in which hackers seek to infect the greatest percentage of computers possible. At least in the past, Mac users represented such a small percentage of the overall computer population, that it just wasn't worth their time to bother looking for vulnerabilities and developing virus programs for Apple operating systems (OS X and iOS.
The growing popularity of iphones (along with ipods and ipads) has changed all that, making it well worth the time and effort it takes to seek out vulnerabilities for iOS to exploit and party down developing viruses, worms, trojans, etc.
However, if this guy had physical access to your iphone, he didn't need to hack it to get your UDID. All he had to do was to use his apple account on your phone to download a free app from the app store called "ad hoc helper" onto your iphone, run the app, and write down the resulting UDID number, and then delete the app along with his account from your iphone, before you returned.
Once someone else has your UDID, well, if their device is jailbroken and they have cydia installed, it is possible that they could "spoof" your UDID and may be able to access and play some of your games, but they can't actually remove any of your apps from your device, or buy new apps with your account. To buy and download apps requires entering your username and password of your apple account, not your UDID number, and there's no way to get your username and password of your apple account from a UDID number.
But if they did jailbreak their own iphone, well, why would anyone break the law to play your games, when, with a jailbroken iphone, they could just pirate their own? Unless screwing with someone else's account happens to fit his definition of "fun."
My bet is that he didn't actually "hack" your iphone because if he did, he'd have gone for the username and password to your Apple account, not your UDID. And if he did that, and wanted to do some damage, he wouldn't have bragged to you about it, because all you'd have to do to stop him, is change your password. On the off chance he did, I recommend you change your password, right now.
Highly doubtful that he actually "hacked" your iphone, and it's believed that only jailbroken iphones are vulnerable, at least at this time. That may be true, but then again, maybe there are viruses for non-jailbroken iphones and the only reason no one seems to know about them, is because no one's running any antivirus protection program on their iphones, so they haven't been detected. I think it may also at least partially depend on your definition of what constitutes a virus, and whether or not you realize that legitimate "parental monitoring software" or "logmein hamachi" can basically be used as a RAT (remote access trojan.) Or that the "find my iphone" app, can also be used to locate and track your every movement, providing, of course, someone can get your username and password, and why bother trying to hack your iphone for that, when it's far easier to get it by hacking it from your itunes account on your computer instead?
The better solution is to change your passwords frequently and monitor all activity and downloads in your itunes account on a regular basis. I check mine every 2-3 days and change all my passwords at least once a month.