The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Escape Character

Posted by Anjan Bacchu on November 29, 2000 at 9:41 PM

Hi All!,

I have a java program (below). I have divided a Long String
into two lines and use the backslash as an escape character.
This works fine in C and C++ but seems to be giving a problem
in java. I consulted my colleagues but none seem to know the
answer. I hate giving up on problems (ultimately).

Can somebody help ?

P.S : I have attached the Compiler Error Message as a comment below the program source.

Thanks and regards,
ANJAN. B


/************************************************/
import java.lang.String;

public class Test
{
public static final void main(String [] args)
{
String strTest = "First Line \
sdfsdfsdf";
}
}

/**
g:\temp\Test.java:7: Invalid escape character.
String strTest = "First Line \
^
1 error
*/

/************************************************/




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us