Operators – Part 2

Advertisements
Advertisements
Advertisements3
Advertisements4
Advertisements6
Advertisements66

  1. What is the result of the following Java expression?

10 & 6

Ans.  2

2. What will be the output for the following expression?

12 ^ 5

Ans. 9

3. What is the syntax of ternary operator in Java?  

Ans. condition? expression1 : expression2;

4. What is the result of the following expression in Java? int x = 10, y = 5; 

int z = x > y ? x : y; 

System.out.println(z);

Ans. 15.

 

Author: Lakshmi Prasanna Ponnala

Completed M.Tech in Digital Electronics and Communication Systems.

Leave a Reply

error: Content is protected !!

Discover more from ece4uplp

Subscribe now to keep reading and get access to the full archive.

Continue reading