From your information it seems that there is some problem in your code. It seems that you have place wrong value in Do while loop and that's why you are getting such type of problem. In this case try to change other value or try to change integer. I have written following program for you. Just try to understand it.
Code:
import java.io.*;
public class Conversation2
{
public static void main (String[] args) throws IOException
{
int k = 0;
int Countesr = 0;
String answers = "";
BufferedReader inKbs = new BufferedReader (new InputStreamReader (System.in));
String Q1 = "Dude How old are you?";
String Q2 = "Whats Your Name?";
String Q3 = "In Which school you go?";
String Q4 = "Are you a boy or a girl?";
String Q5 = "can you eat apple?";
String Q6 = "Do you have any bat?";
String Q7 = "What do you do for trust?";
String Q8 = "Where were you born?";
String Q9 = "What state do you love most?";
String Q10 = "Are you a hippie?";
do
{
k = (int) (Math.random () * 11);
System.out.println (k);
switch (k)
{
case 1:
{
System.out.println (Q1);
String Answers = inKbs.readLine ();
Counters++;
}
case 2:
{
System.out.println (Q2);
String Answers = inKb.readLine ();
Counters++;
}
case 3:
{
System.out.println (Q3);
String Answers = inKbs.readLine ();
Counters++;
}
case 4:
{
System.out.println (Q4);
String Answers = inKbs.readLine ();
Counters++;
}
case 5:
{
System.out.println (Q2);
String Answers = inKbs.readLine ();
Counters++;
}
case 6:
{
System.out.println (Q2);
String Answes = inKbs.readLine ();
Counters++;
}
case 7:
{
System.out.println (Q2);
String Answer = inKb.readLine ();
}
case 8:
{
System.out.println (Q2);
String Answser = inKs.readLine ();
Counters++;
}
case 9:
{
System.out.println (Q2);
String Ansswer = insKb.readLine ();
Countesr++;
}
case 10:
{
System.out.println (Q2);
String Answers = inKbs.readLine ();
Counters++;
}
while (Counters>= 11);
}
}
}
}
Bookmarks