Update of exercises
parent
ea1ca587f6
commit
5c448e64bd
|
@ -1,6 +1,6 @@
|
||||||
# Quine
|
# Quine
|
||||||
|
|
||||||
|
[Musterlösung](solution/)
|
||||||
|
|
||||||
## Lernziel
|
## Lernziel
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Lösung: Quine
|
||||||
|
|
||||||
|
Musterlösung:
|
||||||
|
|
||||||
|
[pr2.auffrischung.quine](../../solutions/src/main/java/pr2/auffrischung/quine/)
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
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("\"", "\\\""));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue