Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

How do I into java

Name: Anonymous 2011-06-03 19:02

Any Javafags here?

So I'm trying too write a program that will print the letters of a string backwards on each line, but I can only get it too print the last letter of the string infinitely. Can anyone show me how I would get the result I want?

This is what I wrote so far:

String word = "anything";
        int length = word.length();
        char letter = word.charAt(length-1);
        while(length > 0)
        System.out.println(letter);

I'm trying to teach my self java, so any help is much appreciated.

Name: Anonymous 2011-06-03 19:10

>>1
Okay, I'll humour you:

You don't reduce your integer by one after each time you've printed the letter.



String word = "anything";
         int length = word.length();
         char letter = word.charAt(length-1);
         while(length > 0)
         System.out.println(letter);
         length == length-1;
         letter == word.charAt (length-1);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List