0
System.out getting initialized in sololearn
This question kind of adds on to my previous question: https://www.sololearn.com/Discuss/2591320/java-console-error Since System.console() can't get initialized due to code playground not being connected to a console, how does System.out get initialized them? since from what I learned System.out, when initialized, is by default connected to your console.
3 Réponses
+ 1
See this: https://docs.oracle.com/javase/6/docs/api/java/io/Console.html
"If the virtual machine is started from an interactive command line without redirecting the standard input and output streams then its console will exist and will typically be connected to the keyboard and display from which the virtual machine was launched."
and it stated: "If the virtual machine is started automatically, for example by a background job scheduler, then it will typically not have a console."
I'm not exactly sure but this might be the reason.
0
I looked it up and it said System.out gets initialized when the system class loads and setOut() method is called and also System.out is by default connected to your console in order to display the output. My question is that sololearn code playground isn't connected to a console hence why in my previous question System.console wasn't working. So how does sololearns's System.out work and if so, why can't System.console work the same way.
0
I feel like this is more of a question for the people that designed sololearn