I am trying to make password check machine , but it isn't working
import java.util.*; public class password{ public static void main (String args []){ Scanner sc = new Scanner(System.in); System.out.println(" SET YOUR NEW PASSWORD "); System.out.println(); String password=sc.nextLine(); System.out.println(); System.out.println(); System.out.println(" NEW PASSWORD HAS BEEN SET SUCCESSFULLY"); for(int i =3 ; i>0;--i){ System.out.println("ENTER THE PASSWORD TO OPEN YOUR BLOG "); String pass = sc.nextLine(); if(pass.equals("password")) { System.out.println(); System.out.println(); System.out.println(" Hello Welcome to blog , you have successfully entred your password an this project demostrate how security works at backend door"); break; }else { System.out.println("INVALID PASSWORD ,TRY AGAIN "); System.out.println(); System.out.println(i+"attempts left"); System.out.println(); System.out.println();} } } }