Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is octal character not taking in Java?

Tags:

java

Hi friends I have following.

 ch\u0061r bala =  '\u0061';
 ch\141r bal = '\141';

ch\u0061r a = '\u0061' is working but ch\141r a1 = '\141' is nt taking as char in Java, both \u0061 and \141 are characters representing the character a.

like image 842
user2572969 Avatar asked Nov 27 '25 07:11

user2572969


1 Answers

In java, Unicode characters (ie \unnnn) may be used anywhere - either in source code or character/String literals, but octal literals (ie \nnn) may only be used in character/String literals.

like image 59
Bohemian Avatar answered Nov 28 '25 19:11

Bohemian