This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, Got this question from Mughal/Rasmussen:- Which of the following lines are valid declarations? Select all valid answers a) char a = '\u0061'; b) char \u0061 = 'a'; c) ch\u0061r a = 'a'; The answer says everything is valid. I can understand the logic behind the answer...you can replace any char with unicode equivalent..but i tried it in SunOne IDE and the compilation fails. Am i doing anything wrong? Thanks
I did a test program with the problem p. 33. The answer is correct Did you type in each line separately and compile it? If you type in all lines together it will try to redefine the literal which you can not do. Got It? Also, did you notice earlier in text about how Unicode is declared so char a = '\u0061' - p25. Character literal valid char \u0061 = 'a' - yep valid rewrite: char a = 'u0061' just replaced value - correct ch\u0061r a = 'a' - think \u0061 is an a right? So char a = 'a' - just replace the values. Understand the meaning of a literal and the assignment operator [ June 17, 2003: Message edited by: James Chegwidden ]