What's the difference between System.out.println and scala's println?

I am trying to silence printing to console

    val fakeOutStream = new PrintStream(new ByteArrayOutputStream)
    val fakeErrStream = new PrintStream(new ByteArrayOutputStream)
    System.setOut(fakeOutStream)
    System.setErr(fakeErrStream)

    println("****This is printed*****")
    System.out.println("*****This is not printed*****")
   

It is recommended to use Console.withOut in Scala. But it has thread localbindings and will only work for output stream in that particular thread.
How to go about silencing writing to outstream and then restoring it back in Scala?

There is no way to globally mutate the output stream used for println.

I have been using Java’s logging facility ever since it came out; it is absolutely marvelous, although one does have to update logging.properties with each new JDK to set them to reasonable values a programmer would want. But setting the output handlers for the output you might want is a trivial chore. Using Java’s logging mechanism, changing the logging properties to more human-readable settings, and running with javaw.exe rather than java.exe may do exactly what you want. I have never run Scala with javaw.exe, so I am not sure it is possible, but that is not critical; you would just have to change more logging properties.