Unfortunately, the Properties class was made to implement Map<Object, Object> when it clearly should have been Map<String, String>. This was probably because Properties was written long before generics came into the language, and Sun in their infinite wisdom chose to retroactively implement Map<Object, Object> in order to not break backwards compatibility for clients using their Properties in an incredibly stupid way. That is, Properties has always allowed people to put things other than Strings in as either keys or values, if they use put() rather than setProperty(), even though only an insane person would ever do this. Rather than fix this error, Sun chose to continue it. That's why you can't simply use "String key : props.keySet()" as you would expect.
Why not loop over the entry set?
Unfortunately you'll need those casts since somebody thought that Properties should extend Hashtable<Object, Object> instead of Hashtable<String, String>, probably because someone somewhere abused Properties and put something other than Strings in it. It's a rubbish reason. If someone was trying to abuse Properties like that they deserve a compiler error.
Wow, beaten by 3 seconds with an answer that's more or less what I said. Auch. Now I know how Campbell feels all the time