Please Answer This Question
:)
:)
:)
:)
Attachments:
Answers
Answered by
0
Answer:
import java.io.*;
import java.util.*;
class GFG {
private static void FindCommonElemet(String[] arr1,
String[] arr2)
{
Set<String> set = new HashSet<>();
for (int i = 0; i < arr1.length; i++) {
for (int j = 0; j < arr2.length; j++) {
if (arr1[i] == arr2[j]) {
// add common elements
set.add(arr1[i]);
break;
}
}
}
for (String i : set) {
System.out.print(i + " ");
}
}
Similar questions