Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create a string from looping characters

807589Oct 24 2008 — edited Oct 24 2008
Hi,

I've been stuck with a little problem concerning a loop.
  
        for (int j = 0; j < inputLength; j++) {
            int randomInteger = (int) Math.round(Math.random() * 94 + 33);
            char resultCharacter = (char) randomInteger;
        }
        return(result);
This is a the part of the loop that I have. I can get my code to work when putting it directly in my UI class, but I want it in a seperate class so that I can just call it. I am wondering if there is a way to put the resultCharacter (everytime it loops!) into a String? I was thinking I had to make an array and then make it a String in the end and return that, however I have been searching and searching and I haven't found anything that could help me.

I hope you guys can :)

Edited by: Jakob90 on Oct 24, 2008 2:40 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2008
Added on Oct 24 2008
8 comments
280 views