Java Reference
In-Depth Information
Here's what mine looks like:
(No, I'm not really 99, but I'm not going to tell you my real age, or my bank
account number, or.…)
If you need to see my code for hints, take a look at code/MySimple/src/mysimple/
MySimple.java .
Organize Instructions into Functions
So now that you can store all kinds of data in variables, next you need to
learn how to write instructions to do fun actions with all that data, from
printing messages to flinging flaming cows in Minecraft.
As you've seen, you can also tell Java to do things. In Java, you organize lines
of code (instructions) inside a pair of curly braces, like { and } . You give that
section of code a name, and those instructions will be run in order, one line
after another. We call that a function (sometimes we'll call it a method ; for
now they mean mostly the same thing).
Why do we bother with functions at all? Couldn't we just have one big list of
instructions and be done? Well, yes, we could, but it can get very confusing
that way.
Think of a list of instructions and ingredients to make a cake with frosting:
•Blend together and bake
•Flour
•Butter
 
 
Search WWH ::




Custom Search