Question: how can i fix this java code ? i need to enter enter two of the integer and display the common elements that appear in
how can i fix this java code ?
i need to enter enter two of the integer and display the common elements that appear in both arrays. Npte that the first number in the input indicates the number of the elements in the list. The number is not part of the list.
the out put should be like this
enter the first array eleeents 1,2,3,4,5,6
enter the second ,2,3,4,5,6,7
the common elements are 2 ,3,4,5,6
this is my code
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String a[])
{
ArrayList
Scanner in=new Scanner(System.in);
System.out.println("Enter first array elements,press space to print next ,press enter to enter second array : ");
System.out.println("Enter second array elementspress space to print next ,press enter to end : ");
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
