posted 8 years ago

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.

Cheers,

public class bubblesort

{

private static void bubble(comparable[] a, int n)

{

// bubbling pass

for(int i=1;i<n-1;i++)

if(a[i].compareTo(a[i+1])>0)

MyMath.swap(a,i,i+1);

}

public static void bubblesort(comparable[] a)

{

// bubble sort

for(int i=a.length;i>1;i--)

bubble(a,i);

}

}

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.

Cheers,

*import java.awt.*;*

import java.util.Arrays;

import java.util.ArrayList;

import java.util.Random;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++)

if(a[i].compareTo(a[i+1])>0)

MyMath.swap(a,i,i+1);

}

public static void bubblesort(comparable[] a)

{

// bubble sort

for(int i=a.length;i>1;i--)

bubble(a,i);

}

}

posted 8 years ago

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

Cheers - Sam.

Twisters - The new age Java Quiz || My Blog

Um Hassan

Greenhorn

Posts: 10

Um Hassan

Greenhorn

Posts: 10

posted 8 years ago

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

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 ?