BufferedReader is not waiting for an input from user
Here is my code... for some reason, ithe BufferedReader does not wait for input from the user... I have included the output that i get when i run it...
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args)
throws IOException{
// TODO code application logic here
char c;
int ctr=0;
String str;
System.out.println("Enter a domino?(y/n):");
c= (char) br.read();
while(c == 'y'){
d[ctr]=new domino();
System.out.println("Enter the top string of domino:");
str = br.readLine();
d[ctr].setTopString(str);
System.out.println("Enter the bottom string of domino:");
str = br.readLine();
d[ctr].setBottomString(str);
d[ctr].setName(ctr+1);
System.out.println("Enter another domino?(y/n):");
ctr++;
c= (char) br.read();
}
System.out.println("Done accepting dominos!");
for(int x=0;x<ctr;x++){
System.out.println(d[x].name);
System.out.println(d[x].topString);
System.out.println(d[x].bottomString);
}
Output:
Enter a domino?(y/n):
y
Enter the top string of domino:
Enter the bottom string of domino:
aba
Enter another domino?(y/n):
y
Enter the top string of domino:
Enter the bottom string of domino:
aab
Enter another domino?(y/n):
n
Done accepting dominos!
1
aba
2
aab
you see how it simply does not give me a chance to input the topstrings at all? wat have i overlooked?>

