CODING:
class ignore{
public static void main(String args[])
{
String arr[] = {"e","d","f","b","a","F"};
System.out.println("Before sorting:");
for(int i=0;i<arr.length;i++)
{
System.out.println(arr[i]);
}
System.out.println("After sorting:");
for(int i=0;i<arr.length;i++)
{
for(int j=i+1;j<arr.length;j++)
{
if(arr[j].compareToIgnoreCase(arr[i])<0)
{
String t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
}
System.out.println(arr[i]);
}
}
}
0 comments:
Post a Comment