I'm new to java and just wrote a program for learning purpose. I have two arrays of strings and i want to compare the length of both string arrays.If lengths are equal then compare the values of each first string array with the values of each second array .If value got matched then print that value. Not able to rectify where the problem is ?
package com.equal.arrat;
import java.util.ArrayList;
import java.util.List;
public class ArrayEqual {
public static void main(String[] args) {
String s[] = {"anuj","kr","chaurasia"};
String s1[] = {"anuj","kr","chaurasia"};
if (s.length==s1.length)
{
System.out.println(s.length);
for (int i =0 ; i>=s.length;i++)
{
for (int j =0 ;j>=s1.length;j++)
{
System.out.println("test");
if (s[i].equals(s1[j]))
{
System.out.println("ok" + s[i]);
}
else{
System.out.println("not ok");
}
}
}
}
else{
System.out.println("Length Not Equal");
}
}
}