+public -private
access modifiers
1/20
Term | Definition |
---|---|
+public -private | access modifiers |
public static final +NAME: dataType = value | constants |
-nameHere: dataType | vars |
+ClassName() +ClassName(dataType varName, dataType varName, etc) | Constructors |
+getVarName(): dataTypeOfVarName | getters / accessors |
+setVarName(dataType varName): void | setters / mutators |
+calculateAThing(info needed): dataType | custom methods |
this.var | references the first var at the top inseatd of the closest |
ClassNameDriver | drivers use the main method |
define the toString() method | otherwise you will just print locations of methods |
Drivers vs Methods | go into a seperate file |
Object o | reference for objects |
only make something private or public | it is an instance variable in a non-driver class |
it doesnt matter if methods exist in the same class, when using objects in a driver method | you need to pass things through, as the object is defined in the main, not the class. |
static methods in the driver cannot access | static vars in the driver |
this. | references the object reffered to run a method |
** * Write a brief description of what the method does (what, not how). * * @param name description of parameter * @return description of returned value */ | Method description |
if you have an object of another class referenced in your method headers and params and args or whatever | then all constructors and setters or whatever involved with that otherClass object will need a deep copy of it |
Object varname = getter for the other class object from the constructor fields | makes a copy we can actually use in the driver |
chain methods to do stuff to otherClass objects like | objName.getOtherClassObj().otherClassMethod(); |