-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYT32.java
More file actions
35 lines (30 loc) · 850 Bytes
/
YT32.java
File metadata and controls
35 lines (30 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*Write a program in JAVA to input any word & print the same in alphabetical order.
* Example: EXaM Output: EMXa
*/
import java.io.*;
class YT32
{
public static void main(String[] args)throws IOException
{
String str;
int x=65;
InputStreamReader I = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(I);
System.out.println("Enter the string: ");
str=br.readLine().trim();
for(int i=x; i<=(x+25); i++)
{
for(int j=0; j<str.length(); j++)
{
if(str.charAt(j)==i)
{
System.out.print(str.charAt(j));
}
}
if(i==90)
{
x=97;
}
}
}
}