मराठी

What are the values of x and y when the following statements are executed? int a = 63, b = 36; boolean x = (a > b) ? a : b; int y = (a < b) ? a : b; - Computer Applications

Advertisements
Advertisements

प्रश्न

What are the values of x and y when the following statements are executed?

int a = 63, b = 36;
boolean x = (a > b) ? a : b;
int y = (a < b) ? a : b; 
थोडक्यात उत्तर

उत्तर

The given condition statement is incorrect:

boolean x = (a > b) ? a : b;

It should be:

boolean x = (a > b) ? true : false; 

then, the values of x and y will be

x = true

y = 36

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1.04: Operators in Java - Review Insight [पृष्ठ ४२]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
पाठ 1.04 Operators in Java
Review Insight | Q 1. | पृष्ठ ४२
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×