|
|
| Author |
Message |
Devook
RealPoor Guru

Joined: 31 Mar 2004 Posts: 2373
Location: Ypsilanti or Troy, MI
|
Posted: 03/21/05 - 13:12 Post subject: Java Problem...
|
|
|
"Using a while statement, write a Java code fragment that prints the characters stored in a String object called str backward."
Go!
|
|
|
Back to top
|
|
|
|
 |
Xion
RealPoor Guru

Joined: 11 Oct 2002 Posts: 2117
Location: Los Angeles, CA
|
Posted: 03/21/05 - 13:17 Post subject:
|
|
|
This is an incredibly easy program to write.
i would learn to do it yourself, as if you don't you're going to bomb whatever class you're in when it comes test time.
|
|
|
Back to top
|
|
|
|
 |
Devook
RealPoor Guru

Joined: 31 Mar 2004 Posts: 2373
Location: Ypsilanti or Troy, MI
|
Posted: 03/21/05 - 13:21 Post subject:
|
|
|
I'm taking the test right now. I have 45 minutes to figure out this one problem because I finished with the rest of the test in about 5 minutes. I just wanted to see if anyone figured it out before I did.
Also, it's funny that the java class definition of a string is the first thing to come up on Google over websites about strings irl.
P.S.
| Code: |
System.out.print("?");
String str = scan.next();
int x = str.length() - 1;
while(x >= 0) {
System.out.print(str.charAt(x));
x--; } |
|
|
|
Back to top
|
|
|
|
 |
Xion
RealPoor Guru

Joined: 11 Oct 2002 Posts: 2117
Location: Los Angeles, CA
|
Posted: 03/21/05 - 13:34 Post subject:
|
|
|
|
edit: my bad, that was C++
|
|
|
Back to top
|
|
|
|
 |
Callaren
RealPoor Sensei

Joined: 03 Dec 2003 Posts: 1598
Location: South Jersey
|
Posted: 03/21/05 - 16:31 Post subject:
|
|
|
JAVA APPLICATIONS SUCK ASS!
TRY{jizz_on_face;}
CATCH{jizz_in_eye;}
God I f*****g hated try catch shit.
|
|
|
Back to top
|
|
|
|
 |
|
|