2
url1 = url1.replaceAll("\","/" );

This code gives error illegal line end in string literal. How to resolve this.

*

govind
  • 163
  • 1
  • 1
  • 11
  • 1
    You need to double-up the backslashes `url1 = url1.replaceAll("\\","/" );` - your editor's syntax colouring should have highlighted this. However, if you have JSON containing a `\"` in a string literal, it will now be broken... – Ken Y-N Sep 08 '15 at 06:04

1 Answers1

2

using "\" character is illegal in java, if you want to express backslash you should write it as double backslashes "\\" since it forms sequences with other characters which evaluates to a single character (e.g. \n = new line, \t = tab). in this case double backslash is a sequence which forms a single backslash character when evaluated.

GiDar
  • 143
  • 2
  • 5