class conditional
{
public static void main(String args[ ] )
{
int i = 20 ;
int j = 55 ;
int z = 0 ;
z = i < j ? i : j ;
System.out.println("The final value assigned to z = " + z ) ;
}
}
What is output of the above program code in BlueJ Java?
Answers
Answered by
0
Answer:
z=20
Explanation:
z=20<55?20:55;
= condition is true so it will print z=20
Answered by
0
Answer:
The final value assigned to z = 20
Explanation:
In the first few lines the process of initialization happens. The variable ‘i’ is assigned a value of 20, j is assigned 55 and z is assigned 0. Next a condition is checed whether i is less than j. If yes i is to be assigned to z otherwise j is to be assigned. As per the value assigned to the variable I and j, I value is less than j, so the value of I is assigned to z and finally the value of z is printed same as the value of i.
Similar questions