this is my code. i wanted it to see if the password the user enters is correct. it supposed to give them 5 tries and when the user puts in the right password it doesn't continue to do the loop 5 times. why wont it stop when the person gets it right.
import java.io.*; import java.util.Scanner public class loop { public static void main(String[] args) { String word; Scanner toy = new Scanner (System.in); int count; count = 0; while (count < 5) { System.out.println(" Enter Password to enter Security System"); word = toy.next(); if ((word.equals("Disney"))) { System.out.print("YAY!"); } else { System.out.println(" too bad try again ") ; } count = count + 1; } System.out.println("SWEET JOB"); } }