Java Program using Loops and Jump Statement
I need to create a program that will ask a password three times. But at the third time, having incorrect password, it will just ask for your name. We are asked to use loops on this and jump statements. Ple开发者_开发知识库ase help. ;)
It's general algoritm,
for (int i = 0; i < 3; i++)
{
if (i == 2 and password != true_password)
ask_name();
}
But for more you can give your code.
p.s. declare i in the loop, thank you @glowcoder for remark.
精彩评论