-3

how can i create a String object from literal ? e.g. i have

String s = " `<div id="top_bin">` ";

this gives an error syntax error on token

kasper_341
  • 85
  • 1
  • 9

1 Answers1

3

You have to escape the quotes used inside the String. Use \" for that:

String s = " <div id=\"top_bin\"> ";
                     ^        ^
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332