I am trying to write a simple bubble sort program but am getting an error that I can't figure out or fix. I am using textpad and get this error:
"bubbleSort.java:56: error: while expected }"

I am sure I am just making a dumb mistake. I am new to prgraming.

Here is the code:

import java.util.Scanner;

public class bubbleSort {

	public static void main (String [] args) {

	double [] bubbleArray  =  new double [10];

	System.out.print  ("Enter 10 numbers ");

	for (int i = 0; i < bubbleArray.length; i++) {

	Scanner input = new Scanner(System.in);

	System.out.println(" ");

	bubbleArray[i] = input.nextDouble();
	}
	double [] newArray = new double [10];

	newArray = m(bubbleArray);


	for (int i= 0; i < newArray.length - 1; i++){
		System.out.println(bubbleArray[i] + " ");
	}
	

}
	public static double [] m(double [] sortedArray) {

			do {
			boolean changed =  false;
			for (int i = 0; i < sortedArray.length - 1; i++) {

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

				double temp;

				temp = sortedArray[i];
				sortedArray[i] = sortedArray[i+1];
				sortedArray[i+1] = temp;

				changed = true;
			}
			else {

			changed = true;
		}


		}while (changed);


			return sortedArray;

}
}

Check that all the {}s are properly matched.
Your formatting makes it very hard to visually scan the code.

changed = true;
} //need closing curly brace after this

You need 1 closing bracket after this bracket which is of the for loop.
And follow NormR1 suggestion, you will be able to track these mistakes easily :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.