Apr 24

Write a java program to find duplicate elements in array?

Number of View: 151

This tutorial explains step by step how to print duplicate elements in an array.Let’s see the steps given below:

Steps to print duplicate elements in array

1)  create and initialize input array.

2)  create an empty set and name it as non duplicate set.

3)  create an empty set and name it as duplicates set. Continue reading

Apr 24

Write a java program to check whether an array contains duplicates or not?

Number of View: 178

In this tutorial we will write a program to check whether an array contains duplicates.First we will write steps how to solve this then we will write a program.

Steps to check whether array contains duplicates or not

1)  create and initialize input array.

2)  Convert the array to list.

3)  Create an hashset using list. Continue reading

Apr 22

write a java program to check two arrays are equal or not ?

Number of View: 104

This tutorial explains how to check two arrays are equal or not with help of an example.Arrays.equals() method is used to check two arrays are equal or not .

Steps to write program:

1) Create and intialize two arrays.

2) Compare two arrays by using Arrays.equals() method which takes tw arrays and returns boolean value if they are true else it returns false. Continue reading

Apr 22

How to create and initialize array in java?

Number of View: 80

Java example to create and initialize array in java