Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help. please. PLEASE!

 
David Crane
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65221
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65221
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And ...

5. Please use code tags when posting code.
 
David Crane
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65221
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did the hint in bold help?
 
David Crane
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65221
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok I'll try it

i9t worked, thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic