Menu
Question Index
...

What will be the output of the following program?

public class CharDemo {
    public static void main(String args[]) {
        char ch1 = 88;
        char ch2 = "Y";
        int i1 = ch1;
        System.out.println("i1 = " + i1);
        System.out.println("ch1 = " + ch1);
        System.out.println("ch2 = " + ch2);
    }
}


i1 = 88
ch1 = X
ch2 = Y
i1 = X
ch1 = X
ch2 = Y
i1 = 88
ch1 = 88
ch2 = 89
Compilation Error
Runtime Error

Doubts

Problems

Topic: Type Conversion In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App