#3 cmsc131 review Flashcards
(8 cards)
overloading
same name, different signatures in the same class.
Same name, different parameter lists
(determined during compile time)
scope
the region of a program where an identifier can be referred to by name
declaration to }
characteristics of a static method
no current obj, can be invoked by class name(b/c doesn’t need to be invoked by an object), can be used if there are no objects in the class
characteristics of a static field
one copy for the entire class, shared among all objects of the class, can be used in static or non-static methods (NONSTATIC FIELDS CAN ONLY BE USED IN NONSTATIC METHODS!!!!!)
4 types of visibility methods
public protected package private (most to least visible)
public vs. private methods
public: functional to users of any class
private: functional to other methods in the same class
protect privacy
instead of getters, add methods to a class itself that return info about fields (avoid exposing the actual field outside of the class)
when are reference copies safe?
when the object is immutable