If statement always giving the same answer

前端 未结 7 546
-上瘾入骨i
-上瘾入骨i 2020-12-12 03:26
import java.util.Scanner;

class Practice {

public static void main(String args[]) {

    System.out.println(\"Enter the number of treats you have:\");
    Scanner          


        
7条回答
  •  渐次进展
    2020-12-12 04:23

    if (enoughTreats = true)

    By using =, you are assigning true to enoughTreats. Use the == comparison operator instead.

提交回复
热议问题