Hi !
I crate method
Check() for comparing charArray and inputChar
In my code, I declared variable charArray such as char[] charArray={'A','N','T'}
and get input from keyboard each character and keep in variable inputChar
When get input 'A' I want compare charArray in index[0]
if equal ...to compare next index ...until last index equal then print "equal"
but my method not so,my method check char by char and no run on index.
How I solve this problem.
public static int Check(char[] charArray , char inputChar){
for(index = 0;index<len;index++){
if(charArray[index] == inputChar){
index++;
if(index == len){
System.out.println("equals");
}
}
}
return index;
}