Java Basics
Reading
- Read this code. The code and its comments are the reading.
- You can read the code in your browser at first, but it is a good idea to also run the code for yourself, see what it does, and try experimenting with it. Please follow these instructions to get the code on your computer and play with it.
Important concepts
- syntax, semantics, syntax error
- declaration
- comments, whitespace
- floating point
- conditionals, if statements
- code formatting, style
Things to consider (exercises for yourself, not to turn in)
- What’s the answer to the puzzle at the end? If you’re not sure, what might it be? Make a guess. What experiment could you do to test that guess?
- What might possibly happen if you put something inside an if statement’s condition that is just a number, like
if(37)
? What do you think should happen? Make a few guesses, then try it. - What other little experiments can you try on this code?
Submission instructions
What was particularly interesting, confusing, or exciting to you in this reading? Please post a response according to the reading assignment procedure.