Wednesday, January 28, 2015

Head First Java Chapter 3

In Chapter 3, we learned all about variables, how they worked and how they are useful.

There are three basic operations we can perform on variables.

We can declare variables, which is stating what a variable "is", its type and name.

We can assign values to them, by using an equal sign.These values can be three different things: They can be a value ( X = 10), you can assign another variable to a variable (X = Y), and  you can assign an expression to a variable (X = X + 5).

We can also use the variables in our code. The dog code above helped me with understanding variables, as I had to actually use variables in my code, and actually writing some code really helps me learn and understand the concepts that the chapter is teaching me.

When naming variables, You must follow certain criteria.
A variable:
  1.  Must Start with a letter, underscore, or dollar sign only.
  2. Can contain numbers, just not start with a letter.
  3. can be anything other than reserved java words

No comments:

Post a Comment