Results 1 to 6 of 6
- 10-09-2011, 08:02 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
What's wrong with this program using escape characters?
I keep getting "unclosed character literal" errors.
public class Wonderland {
private static final char HOOPLA = 'y';
public static void main (String[] args) {
System.out.println(HOOPLA + '/n' + HOOPLA + '/t' + HOOPLA + HOOPLA + '//' + '/'' + HOOPLA + '/b');
}
}
- 10-09-2011, 08:26 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: What's wrong with this program using escape characters?
The escape character is the backslash \ not the forward slash /
kind regards,
JosBuild a wall around Donald Trump; I'll pay for it.
- 10-09-2011, 09:15 PM #3
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
Re: What's wrong with this program using escape characters?
Gracias. Works fine, now. Although the backspace one '\b' isn't doing anything.
- 10-09-2011, 09:20 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
- 10-09-2011, 09:22 PM #5
Member
- Join Date
- Sep 2011
- Posts
- 10
- Rep Power
- 0
Re: What's wrong with this program using escape characters?
Yeah, I added some stuff after the backspace, and then it worked. So I suppose you can't use '\b' unless you have stuff written after it.
- 10-09-2011, 09:59 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: What's wrong with this program using escape characters?
Build a wall around Donald Trump; I'll pay for it.
Similar Threads
-
How to make my program NOT dependent on spaces between characters?
By dragstang86 in forum New To JavaReplies: 4Last Post: 06-30-2011, 03:18 AM -
Escape Characters in xml
By higashij in forum XMLReplies: 2Last Post: 09-23-2010, 09:58 AM -
what the wrong in my program ><
By MSs.Java in forum New To JavaReplies: 4Last Post: 05-03-2010, 02:28 PM -
Need help with escape characters
By jayjones149 in forum New To JavaReplies: 1Last Post: 02-15-2010, 09:10 AM -
what is wrong with this program ?
By Poor Bee in forum New To JavaReplies: 1Last Post: 05-07-2008, 08:23 PM
Bookmarks