tag:blogger.com,1999:blog-7955003209126272036.post4199128264743073022..comments2024-02-23T23:16:22.861+05:30Comments on Geek Explains: Java, J2EE, Oracle, Puzzles, and Problem Solving!: Tricky use of static initializer in Java - Override printlnGeekhttp://www.blogger.com/profile/00648920090539126396noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-7955003209126272036.post-42985676657396819602009-05-24T17:39:51.743+05:302009-05-24T17:39:51.743+05:30In the second option my emphasis was on using the ...In the second option my emphasis was on using the 'line.separator' property and not really on how do we actually implement it. As you have said, we can of course set that programmatically instead of relying on a command line argument.<br /><br />Regarding your question of whether we can use '\n' embedded in the value passed to a command line argument, the answer is NO. In fact, it was logged as aGeekhttps://www.blogger.com/profile/00648920090539126396noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-59693812919580334482009-05-19T23:34:00.000+05:302009-05-19T23:34:00.000+05:30Hi...
In solution #2, u r relying on user to set ...Hi...<br /><br />In solution #2, u r relying on user to set proper line.separator value (" Bye!").<br /><br />Instead, why not set it through code using System.setProperty()??<br /><br />Only thing is, we need to reset the output stream in System class, similar to what you have shown in solution #1.<br /><br />Here is the code:<br /><B>import java.io.*;<br /><br />public class HelloMain { <br /><Vivek Athalyehttps://www.blogger.com/profile/08113944409639107675noreply@blogger.com