Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why doesn't this work in Java?  RSS feed

 
Al Kaiser
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String cvsroot = "c:\src2\cvsroot";
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
String cvsroot = "c:\\src2\\cvsroot";
The backslash is an escape character in a string literal
/n is newline
/t is tab
// is used when you really want a backslash
 
dav mccartney
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Al Kaiser:
String cvsroot = "c:\src2\cvsroot";

I believe you need to do:

Otherwise, the compliler will see a \s and a \c as escape characters, similar to \n for a new line. That's my guess, at least
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!