Friends ,i am in trouble inside this program,please help me🙌🙌🙏🙏 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Friends ,i am in trouble inside this program,please help me🙌🙌🙏🙏

import java.util.Scanner; public class mnb{ public static boolean equal(int []k,int []h){ if(k.length != h.length); return false; for (int i=0 ; i<h.length;i++){ if(k[i] != h[i]) return false; } return true; } public static void main(String[]args){ Scanner input=new Scanner(System.in); System.out.print("The value of n is "); int n=input.nextInt(); int a[]=new int[n]; for(int i=0;i<a.length;i++){ System.out.println("a[" + i + "]="); a[i]=input.nextInt(); } System.out.print("The value of m is "); int m=input.nextInt(); int b[]=new int[m]; for(int i=0;i<b.length;i++){ System.out.println("b[" + i + "]=" ); b[i]=input.nextInt(); } System.out.println("Array of a and b" + (equal(a,b) ? "are same" : "are different")); } }

3rd Jul 2018, 3:31 PM
Hunt
Hunt - avatar
2 Answers
+ 2
Just remove the ; (semicolon) from your fourth line: if( k.length != h.length) return false; And then, you're good to go! P.S: Welcome Hunt !
3rd Jul 2018, 3:38 PM
777
777 - avatar
0
Thank you my friend
3rd Jul 2018, 3:42 PM
Hunt
Hunt - avatar