Two Laptop Bag
The moose likes Beginning Java and the fly likes Input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Input" Watch "Input" New topic


Sadaf Zaidi

Joined: Oct 09, 2001
Posts: 29
I have to generate random characters from A to Z and then take input from the user if user hits the wrong alphabet then I wants to give him a 4 chances for which
I wants to take input five times from the user for this :
tell me how to get input from the user 4 times .
public class Tests
public static void main(String[]args)
char ch;
char input=' ';
for(int i=0;i<4;i++)
System.out.println("Enter a value");
catch(Exception e)
{ }

[This message has been edited by Sadaf Zaidi (edited October 31, 2001).]
Argm Mastoi
Ranch Hand

Joined: Oct 16, 2001
Posts: 35
The problem i'm facing is the code for Input from the user is running only once, rather i call it 4-5 times in the programe but
the program terminates after 1st input.
I tried to check it in a loop also but if the loop goes 4 times, all 4 chars are given at once then it is ok otherwise after enter it takes no input. It should take 4 chars one by one after input but it is not taking it i don't know why.
can u please help.
I agree. Here's the link:
subject: Input
jQuery in Action, 3rd edition