This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Are you trying to create an User object and serialize it using the above code? It won't work this way, because what you are actually creating in the above statement is a String object. So you will get a ClassCastException when you try to cast it into an User object. Try the following code