Off-topic Talk Where overpaid, underworked S2000 owners waste the worst part of their days before the drive home. This forum is for general chit chat and discussions not covered by the other off-topic forums.

Java help for a noob, please.

Thread Tools
 
Old May 29, 2014 | 06:27 AM
  #1  
Cyrax's Avatar
Thread Starter
Registered User
 
Joined: Sep 2013
Posts: 73
Likes: 0
Default Java help for a noob, please.

The program generates random letters and numbers for no purpose other than to give me something to stare at. My problem, is this: I want to tell Java to look for a specific letter "Q", and type a line of text whenever this letter is randomly displayed. I've tried with no luck to google the answer to my question, but given my noobish level, I'm not sure I'm even asking the correct question, i.e. using proper Java syntax / lingo, to refer to my problem. Here is my code, if it helps. Thanks in advance for anyone's help.
Reply
Old May 29, 2014 | 07:52 AM
  #2  
RedCelica's Avatar
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Apr 2002
Posts: 15,342
Likes: 103
From: Raleigh
Default

where's your if statement to determine "Q"? Why do you have i incrementing and have your sleep method in a try block?
Reply
Old May 30, 2014 | 06:21 AM
  #3  
Cyrax's Avatar
Thread Starter
Registered User
 
Joined: Sep 2013
Posts: 73
Likes: 0
Default

Originally Posted by RedCelica
where's your if statement to determine "Q"? Why do you have i incrementing and have your sleep method in a try block?
The purpose was to slow down the rate at which the computer displays the random gibberish in the output window. Without it, the output cannot be seen until I stop the program, this way I have the program generate one character/number at a time, wait 400 milliseconds, then generate the next, and so on.

The if statement to determine "Q", is what I am stuck on. Everything shown in the screen-shot, is what I have at this point. I'm still playing around with it, but I'm out of ideas.
Reply
Old May 30, 2014 | 09:35 AM
  #4  
RedCelica's Avatar
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Apr 2002
Posts: 15,342
Likes: 103
From: Raleigh
Default

I think line 14 should be within an if statement.

Maybe set line 12 equal to a [string]variable and use it to compare your output
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
DancnBalla823
Off-topic Talk
3
Oct 20, 2010 09:04 PM
Tony Yeung
Off-topic Talk
4
Aug 27, 2006 07:39 PM
User 32625
Off-topic Talk
14
Jul 4, 2006 07:53 PM
AquilaEagle
Off-topic Talk
10
Mar 2, 2004 07:48 AM




All times are GMT -8. The time now is 02:45 AM.