java - Array Response Output -


so i'm working on little fun project that'll ask series of questions, , depending on respond with, give specific output. well, i've gotten way first output answer, can't figure out do.

here's source code. can't seem code input question correctly.

import java.util.scanner;  public class questionaire {    public static void main(string[] args) {     scanner in = new scanner(system.in);    string answers[] = new string[1];    string response[] = new string[5];     system.out.println (" evening, devin. how today? ");     answers [0] = in.nextline();        response [0] = "i'm good";    response [1] = "i'm okay";    response [2] = "i'm alright";    response [3] = "i'm great";    response [4] = "good";        if (answers[0].equals (response.length)) {          system.out.println (" that's awesome! talk about?" );       }       else {          system.out.println( " oh, then.." );       }    } } 

output:

 evening, devin. how today?  i'm okay  oh, then.. 

basically, i'm trying if statement take whatever user inputs answer[0] array, , if respond of responses in response array, first system.out, whenever type in of them, keep getting else output. can tell me i'm doing wrong?

you want find match of user input response array.

if (answers[0].equals (response.length)) never evaluate true unless user input 5 because comparing user input response.length value 5. need loop each element in response

or change

if (answers[0].equals (response.length)) 

to

if(arrays.aslist(response).contains(answer[0])) 

you need add import java.util.arrays