posted 16 years ago
For the following 2 codes:
*********code-1*************
public class ADirtyOne
{
//char a = '\u000A';
}
An attempt to compile the above class
1. will complete successfully.
2. will compile sucessfully but with a warning message.
3. will not compile - complains on an invalid expression.
Ans: 3 �unclosed character literal�
*********code-2*************
public class ADirtyOne
{
char a = '\u000A';
}
An attempt to compile the above class
1. will complete successfully.
2. will not compile as 0x000A is out of range for unicode charaters.
3. will complain about illegal character assignment
4. will compile but will cause a runtime error in accessing the variable.
Ans: 3 �illegal line end in character literal� WHY?
Doubt: I couldn't find any reason for the compilation to fail.
pls help
regards,
gitesh
[ August 28, 2007: Message edited by: Gitesh Ramchandani ]