+ 2
How to compare the equality of an array char elements with the another array of char individually
2 Answers
+ 1
Simple way:
Use a for loop to compare each of the elements individually.
Boolean equal=true;
for(int i=0;i<arr1.length;++i)//both arrays are of same size-assumption
{
if(arr1[i]!=arr2[i])
{
equal=false;
break;
}
}
More efficient way:
https://www.tutorialspoint.com/compare-two-char-arrays-in-a-single-line-in-java
Use the search bar before asking, because this question looks like already asked question =)
0
7