<aside> 📚
L2.3 — The Java Library recaps encapsulation and constructors, then covers the Java Library (importing classes, packages, implementation vs interface), String comparison pitfalls (identity vs equality with four scenarios), and introduces HashMaps as a generic key-value collection with lookup, autoboxing, and practical usage.
</aside>
protected means (class + sub-classes only)java.lang, auto-imported).equals() to compare string values, not ==get() and insertion with put()protected KeywordThe protected keyword tells Java that only methods in the class and its sub-classes can access the variable. The opposite is public, which allows all other methods to access it.
Suppose we originally store age as an int: