Java Need To Know

Created by Jaina Stephens

+public -private
access modifiers

1/20

TermDefinition
+public -privateaccess modifiers
public static final +NAME: dataType = valueconstants
-nameHere: dataTypevars
+ClassName() +ClassName(dataType varName, dataType varName, etc)Constructors
+getVarName(): dataTypeOfVarNamegetters / accessors
+setVarName(dataType varName): voidsetters / mutators
+calculateAThing(info needed): dataTypecustom methods
this.varreferences the first var at the top inseatd of the closest
ClassNameDriverdrivers use the main method
define the toString() methodotherwise you will just print locations of methods
Drivers vs Methodsgo into a seperate file
Object oreference for objects
only make something private or publicit 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 methodyou need to pass things through, as the object is defined in the main, not the class.
static methods in the driver cannot accessstatic 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 whateverthen 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 fieldsmakes a copy we can actually use in the driver
chain methods to do stuff to otherClass objects like objName.getOtherClassObj().otherClassMethod();