Java Task on BubbleSotr

Java Task on BubbleSotr

import java.util.ArrayList;
import java.util.Scanner;

public class BubbleSotr
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
String words []= new String[10];
System.out.print(“Enter 10 words : “);
for(int i =0;i<10;i++)
{
words[i] = scanner.next();
}

System.out.print(“Original Order: “);
for(int i =0;i<10;i++)
{
System.out.print(words[i]+” “);;
}

String temp;
for (int j = 0; j < words.length; j++)
{
for (int i = j + 1; i < words.length; i++)
{
if (words[i].compareTo(words[j]) < 0)
{
temp = words[j];
words[j] = words[i];
words[i] = temp;
}
}
}

System.out.println(“”);
System.out.print(“Alphabetical Order: “);
for(int i =0;i<10;i++)
{
System.out.print(words[i]+” “);;
}
System.out.println(“”);
System.out.print(“Reverse Order: “);
for(int i =9;i>=0;i–)
{
System.out.print(words[i]+” “);;
}
String tempvar;
System.out.println(“”);
System.out.println(“Words Start With Vowel”);
for(int i =0;i<10;i++)
{
tempvar = words[i];
temp = tempvar.toLowerCase();
if((temp.charAt(0) == ‘a’)||(temp.charAt(0) == ‘e’)||(temp.charAt(0) == ‘i’)||(temp.charAt(0) == ‘o’)||(temp.charAt(0) == ‘u’))
{
System.out.println(tempvar+” “);
}
}
}

}