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.

17th Nov 2020, 1:01 PM
pNK
pNK - avatar
3 Answers
+ 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.
18th Nov 2020, 2:10 AM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar
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.
18th Nov 2020, 1:22 AM
pNK
pNK - avatar
0
I feel like this is more of a question for the people that designed sololearn
18th Nov 2020, 1:22 AM
pNK
pNK - avatar