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.
Remember that char is a primitive integral data type in Java. What would an empty integer be? In Java, there's simply no such thing. String is a class. That class has been defined to allow for empty String values, where a String object might exist that contains no characters.
"unclosed" usually means that you have an opening delimiter in your code, but not closing one to match it. If you have only one single-quote (') without a matching single-quote after the next character, you can get this error. Similarly, if you only have one double-quote ("), you will get a similar error for an unclosed String constant. HTH Layne
char myC1 = ''; Why don't it print "Illegal initialization"? The guy who wrote the compiler decided to design things such that when you tried to specify an illegal, non-existant literal char value with '', that the compiler should complain about that. So, it does.
Joined: Feb 06, 2004
Thanks. I try to express concepts learning from all you good guys to see if it's wrong or not. If Java tries to compile codes char myC1 = ''; Java will store ' in heap as value of myC1, but doesn't find closing delimiter. So JVM will show empty character literal unclosed character literal ? Is it right?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com