0

The compiler doesn't like me putting the period into quotes after the variable which is in quotes:

(userString = "Bob";)

\""+userString+ "\"" ".";

My desired output is:

"Bob".

My question is how do I get the compiler to print that period after "Bob"? Netbeans gives it an error for some reason.

Joe
  • 4,877
  • 5
  • 30
  • 51
ANC2017
  • 1
  • 1
  • 7

1 Answers1

1

You use \" for a double quotation character literal, everything else is the same as it would be for a string literal. Hence

String userString = "\"Bob\".";

is what you want.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483