but I know "\n" is use for newline but what is the use of "\10"
I guess backslash's are use to give a special meaning to a character like "\n" for newline but what's special in "\10" ?
naved momin wrote:In Java backslash "\" are used with character for special meaning like for eg: "\n", "\t" etc
but I know "\n" is use for newline but what is the use of "\10"
I guess backslash's are use to give a special meaning to a character like "\n" for newline but what's special in "\10" ?
Paul Clapham wrote:My test code fragment
output 8. So I guessed that octal (base 8) representations might be involved. So I tried
and sure enough I got a compiler error ("Invalid character constant"). So the backslash must mean that the following digits are to be interpreted as octal digits. But like Jeff I was completely unfamiliar with this usage.
Jeff Verdegan wrote:The OP asked about "\10", which, it seems, is different than '\10'.
Paul Clapham wrote:
Jeff Verdegan wrote:The OP asked about "\10", which, it seems, is different than '\10'.
Is it? My test code
outputs 1. And then
outputs 8. So to me it looks like "\10" acts exactly like a 1-character string containing '\10'.
OctalEscape:
\ OctalDigit
\ OctalDigit OctalDigit
\ ZeroToThree OctalDigit OctalDigit
That is because \10 (=\u0008) is a control character. Look here to find out what it means.Praveen Kumar M K wrote:On my Eclipse console, its giving me some weird square like character. I cant even paste that here...