• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

need help. please. PLEASE!

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 " );
}

}
 
Sheriff
Posts: 67663
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67663
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok thanks
 
Bear Bibeault
Sheriff
Posts: 67663
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did the hint in bold help?
 
David Crane
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67663
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok I'll try it

i9t worked, thank you very much
 
Let's go to the waterfront with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic