Menu
Topics Index
...
`

Family


If you need explanation Read this topic

If you need Answer Take test on this topic

Family
What will be the output of the following program?
public class Family {
    public static void main(String[] args) {
        char dad = 10;
        char mom = 'M';
        boolean bro = Character.isDigit(dad);
        boolean sis = Character.isDigit(mom);
        System.out.print(bro + ", " + sis);
    }
}

A. true, false
B. false, false
C. true, true
D. Compilation Error
E. 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 is B,if we assign integer value to char it treats as ascii vlaue and stores appropriate character.

Posted by Raviteja Daggupati    2014-07-15 12:55:19


ans b, the method isDigit() return true if the  charecter value is only digit. so it retuns false , false.

Posted by Damu Surya    2014-07-15 12:56:43


A

Posted by Venkatesh Kotte    2014-07-15 14:29:32


true,false..........

Posted by Arul Palanisamy    2014-07-15 14:33:28


b

Posted by Zeg Abder    2014-07-15 16:38:33


Ans is D..char cannot be assigned an integer value which results in typemismatch

Posted by Badam Swathi    2014-07-16 02:49:30


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

Posted by Merit Campus    2014-07-16 05:35:06


© meritcampus 2019

All Rights Reserved.

Open In App