Results 1 to 2 of 2
Thread: Scanner class in my for loop
- 12-20-2010, 07:20 AM #1Member
- Join Date
- Dec 2010
- Rep Power
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();
- 12-20-2010, 09:48 AM #2
- By RSYR in forum New To JavaReplies: 10Last Post: 04-20-2011, 06:13 PM
- By Phenomena in forum New To JavaReplies: 2Last Post: 04-01-2010, 06:47 PM
- By hhh80p in forum New To JavaReplies: 2Last Post: 02-28-2010, 11:47 AM
- By grifan526 in forum New To JavaReplies: 2Last Post: 07-21-2009, 12:06 AM
- By hyunski in forum New To JavaReplies: 2Last Post: 03-12-2009, 02:15 AM