What will be the output of the following Java code?
class ternary_operator
{
public static void main(String args[])
{
int x = 3;
int y = ~ x;
int z;
z = x > y ? x : y;
System.out.print(z);
}
}
0
1
3
-4
Quiz Recommendation System API Link - https://fresherbell-quiz-api.herokuapp.com/fresherbell_quiz_api
# | Quiz |
---|---|
1
Discuss
|
Which of these statements are incorrect?
Solution |
2
Discuss
|
Which of these is returned by “greater than”, “less than” and “equal to” operators?
Solution |
3
Discuss
|
What will be the output of the following Java program?
Solution |
4
Discuss
|
What will be the output of the following Java program?
Solution |
5
Discuss
|
What will be the output of the following Java program?
Solution |
6
Discuss
|
What is the value stored in x in the following lines of Java code? int x, y, z; x = 0; y = 1; x = y = z = 8;
Solution |
7
Discuss
|
Which of these lines of Java code will give better performance? 1. a | 4 + c >> b & 7; 2. (a | ((( 4 * c ) >> b ) & 7 ))
Solution |
8
Discuss
|
What should be expression1 evaluate to in using ternary operator as in this line? expression1 ? expression2 : expression3
Solution |
9
Discuss
|
Which of these statements are incorrect?
Solution |
10
Discuss
|
What will be the output of the following Java code?
Solution |
# | Quiz |
Copyright © 2020 Inovatik - All rights reserved