-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp_object_arrays.java
More file actions
45 lines (42 loc) · 1018 Bytes
/
p_object_arrays.java
File metadata and controls
45 lines (42 loc) · 1018 Bytes
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
// This test case ask for interpreting array access.
class p_array {
public static void main(String [] args) {
if ((new Sorter().bubblesortDemo()) == true) {
System.out.println("Sort successful");
} else {
System.out.println("Sort failed");
}
}
}
class Sorter {
public boolean bubblesortDemo() {
Integer [] array;
Integer temp;
Integer temp2;
int tmp;
int i;
int j;
boolean isSorted;
int ret;
array = new Integer[8];
temp = new Integer();
temp2 = new Integer();
ret = temp2.create(4);
ret = temp.create(10);
array[5] = temp;
array[4] = temp2;
temp2 = array[5];
System.out.println(temp2.getInt());
return true;
}
}
class Integer {
int i;
public int create(int x){
i = x;
return 0;
}
public int getInt(){
return i;
}
}