Search code examples
javaquotes

Insert double quotation about double quotation mark in string java?


Hello to the community what I need is to have this code in a string:

String nameTablePOJO = "   @Table(name = "\"SGEstado\"", schema = "\"public\""    "

Please someone can guide me in quote with this expression. Thank you.


Solution

  • If I understand your question, you want something like

    String nameTablePOJO = "   @Table(name = \"\\\"SGEstado\\\"\", "
        + "schema = \"\\\"public\\\"\")";
    System.out.println(nameTablePOJO);
    

    Output is

    @Table(name = "\"SGEstado\"", schema = "\"public\"")