You Are Reading

0

Char Sorting: Ascending and Descending in Java

BufferedReader ,

Create a java program that will sort the characters in ascending and descending order

Output:


Source Code:

import java.io.*;
import java.util.*;
public class charSorting
{
private static PrintStream pp=System.out;
public static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public static void main(String args[])throws IOException
{
char[] a=new char[5];
int x,y;

for (x=0;x1)
{
pp.println("You Entered a String!");
x=x-1;continue;
}
else
a[x]=b.charAt(0);
}
pp.println();
pp.print("Given Letter:");
for (y=0;y=0;y--)
pp.print(a[y]+" ");

}
}

0 comments:

Post a Comment

 
Copyright 2010 BufferedReader