diff --git a/hw1/answers.pdf b/hw1/answers.pdf index 92ba228..cf5df1b 100644 Binary files a/hw1/answers.pdf and b/hw1/answers.pdf differ diff --git a/hw1/answers.tex b/hw1/answers.tex index fb88a9b..85357a5 100644 --- a/hw1/answers.tex +++ b/hw1/answers.tex @@ -23,38 +23,42 @@ \item 4: False (== for objects checks for reference equality) \item - 5: False (it is indeed implemented by default - i.e.~in Object, but - the default implementation checks reference equality only) + 5: False (it is indeed implemented by default - more precisely implemented + in Object - but the default implementation checks reference equality only) \item - 6: False (a child class of Tiger may include additional fields that + 6: False (a child class of \texttt{Tiger} may include additional fields that are mutable. However, all properties and behaviour accessible via a - reference of Tiger type is immutable) + reference of type \texttt{Tiger} type can be considered immutable) \item - 7: False (the class is not public) + 7: False (the class itself is not public) \item - 8: False (classes in the same package can read the name field) + 8: False (classes in the same package of \texttt{Tiger} can read the + \texttt{name} field) \item - 9: True (the constructor to implement must explicitly call Tiger's - constructor with super) + 9: True (the constructor to implement must explicitly call \texttt{Tiger}'s + constructor with \texttt{super}) \item - 10: False (the declared type is Number, the runtime type is Integer) + 10: False (the declared type is \texttt{Number}, the runtime type is + \texttt{Integer}) \end{itemize} \section{Exercise B} \begin{itemize} \item - 1: False (the only `collection' data structure based over an unboxed - primitive type is the array) + 1: False (the only ``collection'' data structure based over an unboxed + primitive type is the array -- however arrays are not \texttt{java.util} + collections) \item - 2: True (if the hashCode() return value changes after the mutation then the - implementation of hashMap is unable to recognize it was inserted previously) + 2: True (if the \texttt{hashCode()} return value changes after the mutation + then the implementation of hashMap is unable to recognize it was inserted + previously) \item 3: True \item 4: True \item - 5: False (finally blocks are always evaluated) + 5: False (\texttt{finally} blocks are always evaluated) \end{itemize} \section{Exercise C}