A gripping String Bubble sort array program in java
String Bubble sort array program in Java: solved Java program for ICSE Class 10 Computer Applications with complete BlueJ code, explanation and sample output.
Design a program to create an array of strings, size should be entered by the user(between 5 to 20). And sort the string array in ascending order using the Bubble sort technique.
For more programs
An excellent String program to count words start and end with a vowel
import java.util.*;
class StringLinearSearch
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the size of array between 5 to 20");
int n=sc.nextInt();
String list[]=new String[n];
for(int i=0;i<n;i++)
{
System.out.println("Enter words");
list[i]=sc.next();
}
int len=list.length;
for(int i=0;i<len-1;i++)
{
for(int j=0;j<len-1-i;j++)
{
if((list[j].compareTo(list[j+1]))>0)
{
String temp=list[j];
list[j]=list[j+1];
list[j+1]=temp;
}
}
}
System.out.println("Sorted array");
for(int i=0;i<len;i++)
{
System.out.println(list[i]);
}
}
}Output:
Enter the size of array between 5 to 20
5
Nadiad
Madras
Bombay
Chennai
Agartala
Sorted array:
Agartala
Bombay
Chennai
Madras
Nadiad
For java videos click
https://www.youtube.com/user/trushna.tej
Related Posts
Continue learning with these related articles

Pattern Programs in Java for ICSE Class 9: 8 Solved Patterns with Explanations
ICSE Class 9 Computer Applications pattern programs in Java using nested loops: number and star triangles, inverted triangles, Floyd's triangle, a pyramid, letter and word patterns and a 0-1 pattern, each with output and the logic explained.
Sum of First n Natural Numbers in Java (Loop and Formula)
Find the sum of the first n natural numbers in Java with a for loop, a while loop and the formula n(n + 1)/2, with a dry run and the sums of even numbers, odd numbers, squares and cubes.
Prime Number Program in Java: Check a Number and Print Primes in a Range
Check whether a number is prime in Java by counting its factors, a faster square-root method with isPrime(), and a program that prints all prime numbers in a range.