0
Why doesn't work?
import java.util.Scanner; public class VerificationName{ public static void main(String[] args){ Scanner nameInput=new Scanner(System.in); String[] name={"Mara", "Ioana", "Anastasia"}; int i; for(i=0; i<=3; i++){ if(name[i]==nameInput.nextLine()) { System.out.println("This name is at position " + i); } } System.out.println("Wasn't found"); } }
3 Answers
+ 3
Alexandra Rotaru I edited your code. Please read my comments in the code.
https://code.sololearn.com/ck2aFnUYaqPS/?ref=app
+ 1
No problem. Keep practicing! đ
0
Thank you đ