Fun with Mixed Expressions

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Assume that a contains 6 and b contains 12.0

Answer:

(a/b + 4) / 2 == (6/12.0 + 4) / 2 == (0.5 + 4) / 2 == 4.5/2 == 2.25

Fun with Mixed Expressions

Examine each expression in the following list. Decide if the operator in the button is an integer operation or a floating point operation. Then click on the operator to see if you are correct.

12 35
5.6 -14
( 12 + 0.01 ) 2
( 18.0 - 23.3 ) / ( 73 23 )
-19.45 2.93
( 34 - 12 ) ( 9 / 10 )

Warning: These questions ask if the operator is floating point or integer. The value of the complete expression may be of a different type than one of its operators.

QUESTION 13:

What is the remainder after dividing 13 by 5 (with integer division)?