-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
  • 75
  • 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
  • 83,472
  • 15
  • 149
  • 315