| Author |
why commented line is compiled?
|
Ilakya Mukunth
Ranch Hand
Joined: Mar 13, 2012
Posts: 55
|
|
//char a = '\u000A';
even if i comment this line, i get compile time error. can anyone explain me why?
|
 |
gurpeet singh
Ranch Hand
Joined: Apr 04, 2012
Posts: 895
|
|
|
can you please post your snippet of code so that we can have a better look at your program ?
|
OCPJP 6(100 %) OCEWCD 6(91 %)
|
 |
Ilakya Mukunth
Ranch Hand
Joined: Mar 13, 2012
Posts: 55
|
|
package Samples;
public class Chars
{
public static void main(String[] a)
{
String s = new String();
s = "hello";
s += "@@#";
System.out.println(s);
//char c = '\u000a';
System.out.println(c);
}
}
Output:
popo$ cd Assignments/
popo$ javac -d ./ Char1.java
Char1.java:10: unclosed character literal
//char c = '\u000a';
^
1 error
popo$
|
 |
gurpeet singh
Ranch Hand
Joined: Apr 04, 2012
Posts: 895
|
|
|
please refer this link http://www.coderanch.com/t/264507/java-programmer-SCJP/certification/why-char-not-compiling
|
 |
Ilakya Mukunth
Ranch Hand
Joined: Mar 13, 2012
Posts: 55
|
|
Thank you so much. Can you tell me how can i find the inappropriate unicode values for the char data type?
|
 |
gurpeet singh
Ranch Hand
Joined: Apr 04, 2012
Posts: 895
|
|
|
refer this http://unicodinator.com/#004D
|
 |
Ilakya Mukunth
Ranch Hand
Joined: Mar 13, 2012
Posts: 55
|
|
I tried to add the following lines in the program. I get compile time error "illegal uniciode escape"
1. char c = '\u660';
2. char c = '\u066';
should the unicode value always be of 4 digit (hex a decimal alphabets) value?
|
 |
Ilakya Mukunth
Ranch Hand
Joined: Mar 13, 2012
Posts: 55
|
|
Ilakya Mukunth wrote:I tried to add the following lines in the program. I get compile time error "illegal uniciode escape"
1. char c = '\u660';
2. char c = '\u066';
should the unicode value always be of 4 digit (hex a decimal alphabets) value?
but at the same time, the following works fine
3. char c = '\61';
4. char e = '\061';
|
 |
gurpeet singh
Ranch Hand
Joined: Apr 04, 2012
Posts: 895
|
|
|
\u660 is no code point in unicode code pages. there is an arabic character with code point \u0660. please check the site i linked above. the point is that you must follow exactly whatever code points the unicode guys alloted to various languages , characters all over the world.
|
 |
Ilakya Mukunth
Ranch Hand
Joined: Mar 13, 2012
Posts: 55
|
|
gurpeet singh wrote:\u660 is no code point in unicode code pages. there is an arabic character with code point \u0660. please check the site i linked above. the point is that you must follow exactly whatever code points the unicode guys alloted to various languages , characters all over the world.
Thanks for the reply, what abt line 3 and 4
|
 |
 |
|
|
subject: why commented line is compiled?
|
|
|