wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes String problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String problem" Watch "String problem" New topic
Author

String problem

Will Walder
Greenhorn

Joined: Nov 18, 2001
Posts: 8
Hello,
I have a code in TexPad with a String:
String s ="";
When I copy/paste a text inside the double quotes and compile the program I got a syntax error: unclosed string literal. Could somebody help, please?
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
What is the String you are putting in to it? If it contains " you need to escape them so that it would look like
String s = "Hello to all my \"good\" buddys";
instead of
String s = "Hello to all my "good" buddys";


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
Does the text you're pasting in have either a quote or a slash in it? Show me the line after you've pasted text into it. I have a feeling either there is a quote in that text or the last character may be a slash which would be "escaping" the close quote.
Post the line after you've pasted the text and we'll figure it out.


For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
Will Walder
Greenhorn

Joined: Nov 18, 2001
Posts: 8
Thanks,
If I copy/paste e.g. sentence from your message: (What is the String you are putting in to it?) it works fine, but when I try to put a stock quote information from PopUp window inside the double quotes, like
1.65 300 UUB CAA 19:56:33
1.65 100 EEE BEA 19:54:57
1.65 200 TRA TRA 19:53:22
I got that a syntax error message.
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Ensure when you paste it in that the pasted text doesn't end in a line feed. If it winds up like
String s = "1.65 300 UUB CAA 19:56:33
";
You'll get this.
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
Keep in mind that you everything in the quotes must be on one line. You can use the \n escape character to indicate where the new line should start.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String problem
 
Similar Threads
amount currency datatype
Looking for correct data type to take in stream of xml
Please Comment on Data Section
how to sovle these two errors~~~help~~~
SQL Data Types