char c='\101';//there is no u after slash what does it mean? I think Characters can only be represented with hexadecimal numbers using \u. Am I right? ex: char c='\u0000'; Pl explain
tvs sundaram
Ranch Hand
Joined: Jan 28, 2001
Posts: 153
posted
0
Hi Priya, Char literals are single quoted characters or unicode values (begin with \u). HTH
Priya Rajan
Greenhorn
Joined: Jul 06, 2001
Posts: 27
posted
0
Pl explain why this line is compiled? It is neither char nor unicode. char c='\101'; //it prints some char also when printed. I have exam tomorrow. Pl help
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
Wow - that is interesting. The '\101' seems to be interpreted as octal, resulting in 65 decimal = 'A' It is actually in the Java Language Specification 3.10.4 but I never came across it before. Literal char examples given in the JLS are: 'a' '%' '\t' escaped tab char '\\' escaped \ char '\u03ad' unicode - interpret as Hex '\uFFFF' unicode '177' octal plus a couple of examples with non-ascii characters. Bill [This message has been edited by William Brogden (edited July 29, 2001).]
According to William�s book, \xxx is a valid escape sequence. It says in page 34, \xxx is a character in octal representation; xxx must range between 000 and 377. Cheers, Dan
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.