• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Errata in JLS ???

 
Vijay Albuquerque
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the following quote in the JLS document for String literals:
It is a compile-time error for a line terminator to appear after the opening " and before the closing matching ".

I compiled the following code on JDK 1.4.1

The above code compiled and ran fine.
Is the above quote an errata in the JLS or am I missing something?
Thanks in advance !!!
[ November 03, 2002: Message edited by: Vijay Albuquerque ]
 
Ron Newman
Ranch Hand
Posts: 1056
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A "line terminator" isn't a semicolon. A line terminator
is the end of a line -- a newline or carriage return.
This is what the JLS prohibits:

The compiler complains:
Test.java:3: unclosed string literal
String test = "This is
^
Test.java:4: unclosed string literal
a test";
^
Test.java:4: ';' expected
a test";
^
3 errors
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic