Bubble sort(not able to find the error)

public class Bubblesort
{
public static void main(String[] args)
{
int[] arr={73,68,43,88};
System.out.println(bubblesort(arr));
}
public static void bubblesort(int[] arr)
{
for(int i=0;i<arr.length-1;i++)
{
for(int j=0;j<arr.length-1-i;j++)
{
if(arr[j]>arr[j+1])
{
int temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
}

}

@jdkatti,
Instead of System.out.println(bubblesort(arr)); use bubblesort(arr);

Because bubblesort has void type and will not be returning anything, we cannot use System.out.println(bubblesort(arr)); to call the function

bubblesort(arr);
System.out.println(arr);

Will this be fine?

@jdkatti,
Use a for loop to print array.

for(int i=0;i<arr.length;i++)
 System.out.println(arr[i]);

Yep, got it
Thank you sir.

@jdkatti,
Please mark the doubt as resolved!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.