Sail E0 Webinar
Question


What is the output of this program?


class mainclass {
public static void main(String args[])
{
char a = 'A';
a++;
System.out.print((int)a);
}
}
Options:
A .  66
B .  67
C .  65
D .  64
Answer: Option A

ASCII value of 'A' is 65, on using ++ operator character value increments by one.
output:
$ javac mainclass.java
$ java mainclass
66




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers