Classes: What are they? What do they do?
- Classes are structures of code that can tell what exactly an object knows and or does
- Things, or data that an object knows are refered to as "Instance Variables"
- "Methods" are the things a specific object does
- Methods use Instance Variables explicitly to differentiate between various objects.
- Methods can have parameters like functions in Python.
- Methods in Java can have several parameters.
- When using parameters they must match the variable type IN the method. (ex. If i use a float for a parameter and call it an int inside of the method, it wont compile)
- Methods must return somthing unless it is explicity stated it wont with a "void" command.
Activities:
- The first activity was relatively easy to decipher, side A being correctly coded, will output 42 84. Section B was moderately dificult however. The only error i spotted in the code was "void getTime()". The only reason this was flawed because it wasnt declaired as a string variable, so Java would not be able to read it correctly. It also seemed worth to note that GET methods must return a value of some sort.
- This section was hard for me to keep track of becasue the modification of many variables in quick sucession. I ended up sorting through it one line at a time plugging in each of the values to figure out Java's output for all of the commands.
No comments:
Post a Comment