uebungen/solutions/src/main/java/pr2/auffrischung/quine/Quine.java

20 lines
675 B
Java
Raw Normal View History

2023-06-05 22:53:27 +02:00
package pr2.auffrischung.quine;
public class Quine {
private static final String DATA = "package pr2.auffrischung.quine;%n%n"
+ "public class Quine {%n%n"
+ " private static final String DATA = \"%s\";%n%n"
+ " public static void main(String[] args) {%n"
+ " System.out.printf(data, %n"
+ " DATA.replace(\"\\\\\", \"\\\\\\\\\")%n"
+ " .replace(\"\\\"\", \"\\\\\\\"\"));%n }%n}";
public static void main(String[] args) {
System.out.printf(DATA,
DATA.replace("\\", "\\\\")
.replace("\"", "\\\""));
}
}