More Complicated 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

Answer:

x: 100 y: 99

More Complicated Expressions

The expression on the right of the = can be more complicated, as in the following fragment:

int value = 10 ;
int result = 0 ;

result = value++ * 2 ;

System.out.println("value: " + value + "  result: " + result );

I strongly advise that you avoid writing such expressions. But other programmers will write such expressions, so you need to be able to read them. You may encounter these expressions when you help other programmers debug their poorly written programs.

QUESTION 4:

What does the above fragment print out?