1. the result is int and must be cast . auto conversion takes place with +=,*=..... 2.unicode char \u000a is translated by the compiler into a linefeed first thing before compilation so the result is: 1. char c=' 2. '; missing terminator on line one. hope am right.
Aymen Esawey<br />SCJP <img src="smile.gif" border="0"> <br /><a href="http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=32&t=001968" target="_blank" rel="nofollow">how to nuke the SUN </a>
Hi Sandeep, 1. byte b=1; b= b+1; //In this case b implicitly converted into int //and the result of right side calculation is //int. That's why you'll get an error. You can //do following b= (byte)(b+1); b+=1 // In this case Java does conversion to int. That's all. 2. '\u000A' is a "carriage return" in java. You cannot use '\u000D' as well. Please search forums, in this site, youl get a lot of topics devoted this. Thanx, Jam
Joined: Oct 09, 2000
Good replies Guys !!! Thanx But my point in 2nd question is... even though the line is commented, still it gives compilation error. Pls elaborate. [ March 13, 2002: Message edited by: Sandeep Lodhia ]
Hello Sandeep When u compile any Java program and if this code contains any unicode literal then before compilation those unicode literal first converted to ASCII (or machine default) character literal. so before compilation of 1. //char a= '\u000A'; will be translated to 1. //char a=' 2. ';
so during compilation line 2 will give compile time error. Hope this will help u....