Menu
Question Index
...

What will be the output of the following program?

public class Letter {
    public static void main(String[] args) {
        char ch = 'S';
        char ch2 = '8';
        boolean flag = Character.isLetterOrDigit(ch);
        boolean flag2 = Character.isLetterOrDigit(ch2);
        if (flag == true) {
            System.out.println(flag);
        }
        if (flag2 == true) {
            System.out.println(flag2);
        } else
            System.out.print(false);
    }
}


true
true
false
true
false
true
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