Tuesday, 13 August 2013

The second User Input stage is not showing up

The second User Input stage is not showing up

import java.io.*;
public class AdamHmwk4 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
int counter1;
int counter2;
int counter3;
String answer = "";
System.out.println("Welcome to Adam's skip-counting program!");
System.out.println("Please input the number you would like to skip
count by.");
counter1 = Integer.parseInt(br.readLine());
if (answer.equals(counter1)) {
System.out.println("Please input the number you would like to
start at.");
counter2 = Integer.parseInt(br.readLine());
if (answer.equals(counter2)) {
System.out.println("Please input the number you would like to
stop at.");
counter3 = Integer.parseInt(br.readLine());
if (answer.equals(counter3)) {
System.out.println("This is skip counting by");
System.out.println(counter1);
System.out.println(",starting from");
System.out.println(counter2);
System.out.println("and ending at");
System.out.println(counter3);
}
}
}
}
}
When I compile and run this code, the first part executes well, but when I
input a number for it, the next user input part does not show. Please keep
in mind that I am new to Java.

No comments:

Post a Comment