If statement always giving the same answer

前端 未结 7 512
-上瘾入骨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.

    0 讨论(0)
提交回复
热议问题