Results 1 to 6 of 6
- 10-09-2011, 07: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, 07:26 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: What's wrong with this program using escape characters?
The escape character is the backslash \ not the forward slash /
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 10-09-2011, 08: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, 08:20 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 10-09-2011, 08: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, 08:59 PM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: What's wrong with this program using escape characters?
When people rob a bank they get a penalty; when banks rob people they get a bonus.
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, 02:18 AM -
Escape Characters in xml
By higashij in forum XMLReplies: 2Last Post: 09-23-2010, 08:58 AM -
what the wrong in my program ><
By MSs.Java in forum New To JavaReplies: 4Last Post: 05-03-2010, 01:28 PM -
Need help with escape characters
By jayjones149 in forum New To JavaReplies: 1Last Post: 02-15-2010, 08:10 AM -
what is wrong with this program ?
By Poor Bee in forum New To JavaReplies: 1Last Post: 05-07-2008, 07:23 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks