Menu
Topics Index
...
`

Wall


If you need explanation Read this topic

If you need Answer Take test on this topic

Wall
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);
        }
    }
}

A. A1
B. AA 1
C. A 1
D. Some other output
E. Compilation Error or Runtime Error
Topic: Java Character Class

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans :c first A is a character it will print then space is white space is printed next and 1 is digit so it will be printed

Posted by Vicky Maduri    2014-06-12 12:53:24


Ans is B.. 'A' is a letter and uppercase.. so both of them becomes true..

Posted by Om Prakash Om    2014-06-12 13:10:16


Congratulations Vicky Maduri. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-06-13 04:08:45


© meritcampus 2019

All Rights Reserved.

Open In App