Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class project {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String up = "";
- String down = "";
- System.out.print("Give a string: ");
- String x = sc.nextLine();
- int z = x.length();
- for (int y = 0; y < z; y++) {
- if (Character.isUpperCase(x.charAt(y))) {
- char w = x.charAt(y);
- up = up + w;
- } else if (Character.isLowerCase(x.charAt(y))) {
- char w = x.charAt(y);
- down = down + w;
- }
- }
- System.out.println("The uppercase characters are: " + up);
- System.out.println("The lowercase characters are: " + down);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement