Java program to find common elements between two Arrays

preview_player
Показать описание
About this Video:
In this You will learn how to find common elements between two
given Arrays using a simple demo project

Follow me on Social network:

KK JavaTutorials WebSite:

Subscribe KK JavaTutorails YouTube Channel:

Subscribe My Hindi Channel(KK HindiGyan):

Some Important Playlist link on KK JavaTutorials:

Spring Framework Tutorial:

Eclipse shortcuts :

Java 8 Features Tutorial(All In One):

JDBC Tutorial in depth[Must Watch]

Java 8 Stream APIs:

WebLogic Server Tutorials:

Spring Boot Tutorial(All In One):

Hibernate Tutorials:

Java 5 new features Tutorials

Java 7 Features tutorials:

Java multithreading for beginners:

Java Collections framework Tutorials:

OOPs concepts in java Tutorials:

You will get source code from below KK JavaTutorials blog Page:
Рекомендации по теме
Комментарии
Автор

Here why you used break, can please let me know sir .

vepanjerikeerthisree
Автор

Hello Sir, Can u please make some videos on how we can upload files through Spring MVC?

sumitbasu
Автор

what if size is not same of two array

dnyaneshwarchavan
Автор

private static void findCommonElements(int[] arr1,
int[] arr2)
{

// Check if length of arr1 is greater than 0
// and length of arr2 is greater than 0
if (arr1.length > 0 && arr2.length > 0) {
Set<Integer> firstSet = new HashSet<Integer>();
for (int i = 0; i < arr1.length; i++) {
firstSet.add(arr1[i]);
}

// Iterate the elements of the arr2
for (int j = 0; j < arr2.length; j++) {
if (firstSet.contains(arr2[j])) {
System.out.println(arr2[j]);
}
}
}
}

Anand
join shbcf.ru