Scanner class in my for loop
Alright I'm relatively new to Java and I'm nearly done with my first Java class.
I am currently working on my final and I have run into a snag. I probably knew the answer to this issue at one point, but have forgotten it.
Can someone explain to me why this code won't loop despite me sending the for loop the proper keyboard input via Scanner p so that the boolean would be true. I decided to make a small sample program so that no one will have to read through the pile of coding since my final is nearly complete I just need to loop it.
I would really appreciate fast help because my final and it is due in 20 minutes.
String i = "y";
for(j = 0; i == "y"; j++)
Scanner p = new Scanner(System.in);
i = p.nextLine();