Sail E0 Webinar
Question


What is the output of this program?


class char_increment {
public static void main(String args[])
{
char c1 = 'D';
char c2 = 84;
c2++;
c1++;
System.out.println(c1 + " " + c2);
}
}
Options:
A .  E U
B .  U E
C .  V E
D .  U F
Answer: Option A

Operator ++ increments the value of character by 1. c1 and c2 are given values D and 84, when 

we use ++ operator their values increments by 1, c1 and c2 becomes E and U respectively.

output:
$ javac char_increment.java
$ java char_increment
E U



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers