This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Bubble Sort>>>Nice program but??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Bubble Sort>>>Nice program but???" Watch "Bubble Sort>>>Nice program but???" New topic

Bubble Sort>>>Nice program but???

Um Hassan

Joined: Jun 16, 2009
Posts: 10
Hi everybody,
I'm a student in java and I've this program in my assignment. I tried to do it(sorting with bubble is really nice),but I have problem with run this program? Any help I'll glad to thank you.

import java.awt.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Random;

public class bubblesort
private static void bubble(comparable[] a, int n)
// bubbling pass
for(int i=1;i<n-1;i++)
public static void bubblesort(comparable[] a)
// bubble sort
for(int i=a.length;i>1;i--)

Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

So what is the problem that you are facing when you run this program?

Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
siddhu Math
Ranch Hand

Joined: Aug 10, 2006
Posts: 46
Could you just append the error trace over here .....
Um Hassan

Joined: Jun 16, 2009
Posts: 10
maybe relation between importing and comparable and MyMath , really I don't know?
Here, attachement photo for error message will explain.

[Thumbnail for error_ms.JPG]

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41149
The JDK does not have a class "comparable", so unless that's one of your classes, that would be a problem. Note that Java is case-sensitive, maybe you meant "Comparable"?

Ping & DNS - my free Android networking tools app
Um Hassan

Joined: Jun 16, 2009
Posts: 10
It isn't my own class, this program is already in textbook and I applied the compile.
Thanks alot.. Sam, siddhu Math and Ulf Dittmer
Ulf Dittmer , you are right about Java is case-sensitive. However what about (MyMath) it's still ?
Henry Wong

Joined: Sep 28, 2004
Posts: 18545

However what about (MyMath) it's still ?

There is no such class in the core Java API. And considering that the class name starts with "My", it is likely something that you have written (or supposed to have written) as part of your assignment.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link:
subject: Bubble Sort>>>Nice program but???
Similar Threads
Sorting array on command line
Generics - what does it mean "? super T"?
Deep cloning not working
Searching an array - output problems - Please help!!
sorting an array