Menu
Topics Index
...
`

House


If you need explanation Read this topic

If you need Answer Take test on this topic

House
What will be the output of the following program?
public class House {
    public static void main(String args[]) {
        char fan[] = {'A', 'b', 1};
        for (char element : fan) {
            if (Character.isLetter(element))
                System.out.print(element);
            if (Character.isUpperCase(element))
                System.out.print(element);
            if (Character.isLowerCase(element))
                System.out.print(element);
            if (Character.isDigit(element))
                System.out.print(element);
        }
    }
}

A. AAbb
B. Ab1
C. AAbb1
D. 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 D compilation error we can not store int in char array

Posted by Ashok Reddi    2014-02-14 03:52:37


ans is A ,becoz if we assign a decimal to char variable it treats as ASCII value,not as digit.

Posted by Raviteja Daggupati    2014-02-14 06:00:54


And is A . B'coz up to char range it"all take numbers also...

Posted by Nagendra Penumalli    2014-02-14 06:26:51


ans is D because of insufficeint memory of storage

Posted by Manasa Jyothi Sree    2014-02-14 06:42:32


Ans is C

Posted by Bharath Yelchuri    2014-02-15 14:38:39


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

Posted by Merit Campus    2014-02-17 04:09:36


© meritcampus 2019

All Rights Reserved.

Open In App