Question:

What the problem this java program???

by Guest59078  |  earlier

0 LIKES UnLike



class bubbleSort1{

public static void bubbleSort(int[] x) {

int n = x.length;

for (int pass=1; pass < n; pass++) { // count how many times

// This next loop becomes shorter and shorter

for (int i=0; i < n-pass; i++) {

if (x[i] > x[i+1]) {

// exchange elements

int temp = x[i]; x[i] = x[i+1]; x[i+1] = temp;

}

}

}

}

}

the output say..

java.lang.NoSuchMethodError: main

Exception in thread "main"

Process completed.

 Tags:

   Report

2 ANSWERS


  1. you have to set the main method..... :

    public class bubbleSort1 {

        

      

      public static void main(int[] x) {

    int n = x.length;

    for (int pass=1; pass &lt; n; pass++) { // count how many times

    // This next loop becomes shorter and shorter

    for (int i=0; i &lt; n-pass; i++) {

    if (x[i] &gt; x[i+1]) {

    // exchange elements

    int temp = x[i]; x[i] = x[i+1]; x[i+1] = temp;

    }

    }

    }

    }

        

    }


  2. sorry try asking on some forum dedicated to computer programming... u won&#039;t get many results here.

    not too many people know java on yahoo answers lol

    good luck though

    i only know really basic java

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.