I have a String[]
with values like so:
public static final String[] VALUES = new String[] {\"AB\",\"BC\",\"CD\",\"AE\"};
Given
You can check it by two methods
A)By converting the array into string and then check the required string by .contains method
String a=Arrays.toString(VALUES);
System.out.println(a.contains("AB"));
System.out.println(a.contains("BC"));
System.out.println(a.contains("CD"));
System.out.println(a.contains("AE"));
B)this is a more efficent method
Scanner s=new Scanner(System.in);
String u=s.next();
boolean d=true;
for(int i=0;i