• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compiler Error in Commented Line. Why ?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class ADirtyOne
{
//char a = '\u000A';
}

Why is this giving a compiler error
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
'\u000A' is the escape sequence for carriage return.So what you have ultimately is

public class ADirtyOne
{
//char a =
;
}

Thats why you get the error.
[ April 10, 2006: Message edited by: Nila dhan ]
 
Srinu Nanduri
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. So, do we need to remember all the escape sequences (in char) for the exam. If so, can you please give me all the values.

as you said

\n - \u000A
\b - ?
\f - ?
\r - ?
\t - ?
\' - ?
\" - ? and etc if any.
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
At the examen, its written what \u000A or else is(means)...so you don't have to learn all of these things ( thx to God, lol )
arno
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

Adding some more to this , using '/u000d' while assigning throws compile time error , since is represents new line character.





Thanks,
Prakash
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
NOT CORRECT I THINK

'\u000A' is the escape sequence for carriage return.So what you have ultimately is

public class ADirtyOne
{
//char a =
;
}

Thats why you get the error.




I can use:
public class ADirtyOne
{
//char a =
;;;;;;;;;;;;;;;;;;;;; //any number of ; as they are just null statements
}
[ April 10, 2006: Message edited by: Sandeep Singh Kunwar ]
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think he meant that you uncomment the line that is what it will look like.
[ April 10, 2006: Message edited by: Keith Lynn ]
 
Sandeep Singh Kunwar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats true.
Ofcourse we have to then assign some value.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I think the next line would be

';

and not just

;

Because of the single quote after the HEX

Mark
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
// char c = '\\u000A';

this wont give any error.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic