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"); } }

11th Nov 2018, 11:00 PM
Alexandra
Alexandra - avatar
3 ответов
+ 3
Alexandra Rotaru I edited your code. Please read my comments in the code. https://code.sololearn.com/ck2aFnUYaqPS/?ref=app
11th Nov 2018, 11:46 PM
Lambda_Driver
Lambda_Driver - avatar
+ 1
No problem. Keep practicing! 😀
12th Nov 2018, 9:29 AM
Lambda_Driver
Lambda_Driver - avatar
0
Thank you 😄
12th Nov 2018, 6:50 AM
Alexandra
Alexandra - avatar