in der übung wird reverse gezeigt, das funktioniert
package de.codegym.task.task19.task1911;
import java.io.*;
/*
Reader-Wrapper
*/
public class Solution {
public static TestString testString = new TestString();
public static void main(String[] args) {
PrintStream consoleStream = System.out;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream print = new PrintStream(baos);
System.setOut(print);
testString.printSomething();
String result = baos.toString();
System.setOut(consoleStream);
StringBuilder stb = new StringBuilder(result);
stb.toUpperCase();
String end = stb.toString();
System.out.println(end);
}
public static class TestString {
public void printSomething() {
System.out.println("This is text for testing");
}
}
}