Saturday, January 27, 2007

What you want, what you get

Finished my CS1102 Lab Programming exercise this afternoon. This is the second lab assignment. I manage to finish the first one (last week) very fast because it is pretty straight forward – using String only. The second lab suppose to be easy also, but I forget the code to output system message, so in the end, I spent the whole night before trying to “create” an way to output the error message, using the following method.
java Cat out.txt 2>error.txt
Yeah, probably those who understand dos command prompt and programming know what it means. It is very easy to redirect the system message to “error.txt”, right?
Note:
“>” means redirect all output to the file that comes after it.
“2>” means redirect system message to the file that comes after it.
Luckily I went for SoC Soccer Training this morning and manage to ask the help of another senior. Phew. Or, else, now probably I’ll still be sitting here, scratching my head trying to figure out the solution.
System.err.println(“error message”);
This is the “method”. Why didn’t I think of finding the method list of “System”. Should have remembered Mr. Ang’s favorite quote

What you want, what you get!
Hah!

2 comments:

  1. lau eh..

    what u want, what u get..

    makes me think of mr ang

    ReplyDelete
  2. Haha. Think I will not forget that phrase of his! =p

    ReplyDelete