Page 361 - Computer science 868 Class 12
P. 361
{ strbuf.append((char)(ch - 13)); }
else
{ strbuf.append(ch); }
}
String changestr = strbuf.toString();
System.out.println("Ceaser Cipher text is:");
System.out.println(changestr);
}
}
Some More Programs
Program 1 Write a program in Java to enter a string in mixed case. Arrange all the letters of the string
such that all the lowercase characters are followed by the uppercase characters.
Sample Input:
India New Delhi
Sample Output:
ndiaewelhiIND
1 import java.util.*;
2 class program1
3 {
4 public static void main()
5 {
6 Scanner sc = new Scanner(System.in);
7 System.out.print("Enter string: ");
8 String str = sc.nextLine();
9 int len = str.length();
10 String strl="",stru="";
11
12 for (int i = 0; i < len; i++) {
13 char ch = str.charAt(i);
14 if (Character.isLowerCase(ch))
15 strl=strl+ch;
16 else if (Character.isUpperCase(ch))
17 stru=stru+ch;
18 }
19 System.out.println("Input String:");
20 System.out.println(str);
359
Strings 359

