OK刚刚我看C那里有一个叫有奖答题的东东。现在我也写个题目。第一个答对的有50分的加分(版主除外)。
In case you guys want to get used to Java English, i will write the whole thing in English
(In face, it is also a bit hard for me to translate all the Java word into Chinese,:P, sorry guys)
Ok, I promise the question i write (and maybe future??) will be nice and simple so that most of people here will actually have a chance to do this (and at least think).
=====================================================================
Here comes the Question.
Write a class, called Reverse.java, which takes an command line argument, and print that String back to the screen but in its reverse order.There are lots of ways to do the simple task!!!
For example:
C:\javaPro\java Reverse apple
elppa <<<<<this is the output
C:\javaPro\java Reverse a
a <<<<<<this is the output
C:\javaPro\java Reverse "apple tree"
eert elppa <<<<<<this is the output
(you can assume that the user will enter at lease one character so that no Exception will be ever thrown...
Extension: If no loop is allowed in this question, what will you do it? (if you could do without any loops in the class, +60 :-) )
Have Fun!!!
=====================================================================
Important: When you reply, do not just write a post and reply, please upload an attachment as a .java file (in this case Reverse.java), to do this, it will make much simpler when you are writing the program and it is also easy for others (including me) to check if your program works or not (since we can run it straightaway without copy and paste).
If you are the 1st, and 50 will be added!
[此贴子已经被作者于2004-09-15 21:04:05编辑过]