Output Questions for Class 10 ICSE Computer Applications
What is the output produced by the following lines of program code?
char x, y;
x = 'y';
System.out.println(x);
y = 'z';
System.out.println(y);
x = y;
System.out.println(x);
Java
Values & Data Types Java
425 Likes
Answer
Below is the output produced by this code:
y
z
z
Variable x is assigned a value of character y so the first println prints y. Variable y is assigned a value of character z so the second println prints z. After that variable x is assigned the value of variable y which is the character z so last println prints z.
Answered By
171 Likes