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());
System.out.println("Please input the number you would like to start at.");
counter2 = Integer.parseInt(br.readLine());
System.out.println("Please input the number you would like to stop at.");
counter3 = Integer.parseInt(br.readLine());
System.out.println("This is skip counting by" + counter1 + ", starting at" + counter2 + "and ending at" + counter3 +":");
while (counter2 = counter3) {
counter2 = counter2 + counter1;
counter3 = counter2 + counter1;
}
}
}
我正在尝试制作跳过计数程序。当我编译此代码时,该行while(counter2 = counter3){
显示为不兼容类型错误。编译器说它找到了一个“int”,但它需要一个“boolean”。请记住,我是一个新手,所以我还没有在我的 Java 类中学习布尔值。