Menu
Question Index
...

What will be the output of the following program?

public class Wall {
    public static void main(String args[]) {
        char fan[] = {'A', ' ', '1'};
        for (char element : fan) {
            if (Character.isLetter(element))
                System.out.print(element);
            else if (Character.isUpperCase(element))
                System.out.print(element);
            else if (Character.isWhitespace(element))
                System.out.print(element);
            else if (Character.isDigit(element))
                System.out.print(element);
        }
    }
}


A1
AA 1
A 1
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Character Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App