-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbarclass16.java
55 lines (52 loc) · 1.52 KB
/
barclass16.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.util.Scanner;
public class barclass16 {
public static void main (String args []) {
System.out.println("Input two arrays. Both arrays will have the same size");
Scanner in = new Scanner(System.in);
int count = 0, cell = 0;
String[] a = new String[4];
String[] b = new String[4];
while (cell < 4) {
System.out.println("Input Values for Array A");
String temp = in.nextLine();
int c = 0;
for (int i = 0; i < cell; i++) {
if (temp.equals(a[i])) {
c++;
}
}
if (c == 0) {
a[cell] = temp;
cell++;
}
}
cell = 0;
while (cell < 4) {
System.out.println("Input Values for Array B");
String temp = in.nextLine();
int c = 0;
for (int i = 0; i < cell; i++) {
if (temp.equals(b[i])) {
c++;
}
}
if (c == 0) {
b[cell] = temp;
cell++;
}
}
for (int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
if (a[i].equalsIgnoreCase(b[i])) {
count++;
}
}
}
if (count == 4) {
System.out.print("Arrays A and B are equal");
}
else {
System.out.print("Arrays A and B are unequal");
}
}
}