While writing a Quine (i.e. a self-replicating program) in Java, I tried to indent output lines using tab characters:
...
char tab = '\t';
char qm = 34;
char comma = ',';
...
System.out.println(tab + tab + tab + qm + listing[i] + qm + comma);
...
This doesn't work because the plus operator in "tab + tab + ..." adds the tab character values rather than generating a string (61 = 9 + 9 + 9 + 34):
...
61 public static void main(String[] args) {",
...
Placing an empty string at the beginning does the job:
...
System.out.println("" + tab + tab + tab + qm + listing[i] + qm + comma);
...
However, I can't use plain quotation marks in the Quine setting as I need to escape them to output the program text itself.
I wonder if it is possible to enforce the interpretation of the plus operator as String concatenation WITHOUT explicitely using quotation marks or additional Java classes?