| Author |
need help. please. PLEASE!
|
David Crane
Greenhorn
Joined: Aug 29, 2009
Posts: 15
|
|
ok I keep getting messages that say illegal escape character. and I don't have any idea what one is. here's a copy of my code. I've gotta make it so it displays a image made of characters
package maincharactepicture;
public class Main {
public static void main(String[]args)
{
System.out.println(" /\ " );
System.out.println(" / \ " );
System.out.println(" /_ _\ " );
System.out.println(" -----// \ / \\----- " );
System.out.println(" / // / \ \\ \ " );
System.out.println("--------------------/----//---/- -\---\\----\------------------- " );
System.out.println(" l ll l " );
System.out.println(" 0 00 0 " );
}
}
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56538
|
|
A couple of points, David.
1. Welcome to the Ranch.
2. Please use a meaningful subject line.
3. Watch your tone. I've removed some objectionable language from your post.
4. The backslash character has special meaning in Java string literals.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56538
|
|
And ...
5. Please use code tags when posting code.
|
 |
David Crane
Greenhorn
Joined: Aug 29, 2009
Posts: 15
|
|
|
ok thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56538
|
|
|
Did the hint in bold help?
|
 |
David Crane
Greenhorn
Joined: Aug 29, 2009
Posts: 15
|
|
|
yes, would you know a way to use a backslash without that problem? I have to make a picture and I need a backslash to do so
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56538
|
|
|
A little research on Java string literals will tell you that the backslash is the "escape" character that is used to introduce special characters into the string. For example, the sequence "\n" will create a newline character. To create a backslash itself you escape the backslash character -- in other words, use a double backslash to represent the backslash character.
|
 |
David Crane
Greenhorn
Joined: Aug 29, 2009
Posts: 15
|
|
ok I'll try it
i9t worked, thank you very much
|
 |
 |
|
|
subject: need help. please. PLEASE!
|
|
|