Reading Swing code and learning Java
Browsing the code for BasicScrollBarUI (yes, i don't have a life), i was puzzled by the following lines:
(ltr ? decrButton : incrButton).setBounds(leftButtonX,
itemY, leftButtonW, itemH);
(ltr ? incrButton : decrButton).setBounds(rightButtonX,
itemY, rightButtonW, itemH);
Say what? I had no idea that the ternary conditional operator can appear as a primary expression (JLS 15.8) followed by the method invocation. Well - it can (according to the 15.25 of JLS). Finally I have something to impress my wife. "So, honey, how was your day?", "You wouldn't believe!!! Did you know that the ternary conditional operator can appear as a primary expr... Hey, don't fall asleep!!!"