Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java uses unchecked or unsafe operation

807600Sep 28 2007 — edited Sep 28 2007
Anyone can help me take a look at these codes, when i compile it, it shows: \Customer.java uses unchecked or unsafe operations


.........
public int compareTo (Object other){
int result;
result = name.compareTo(((Customer)other).name);
return result;
}

public static void selectionSort (Comparable[] data, int count) {
int min;

for (int index = 0; index < count-1; index++){
min = index;
for (int scan = index+1; scan < count; scan++)
if (data[scan].compareTo(data[min]) < 0)
min = scan;

swap (data, min, index);
}
}

//-----------------------------------------------------------------
// Swaps two elements in the specified array.
//-----------------------------------------------------------------
private static void swap (Comparable[] data, int index1, int index2) {
Comparable temp = data[index1];
data[index1] = data[index2];
data[index2] = temp;
}

..............
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2007
Added on Sep 28 2007
7 comments
2,222 views