hw1: done

This commit is contained in:
Claudio Maggioni 2022-09-25 18:35:18 +02:00
parent a912d72179
commit 3b72b84664
2 changed files with 18 additions and 14 deletions

Binary file not shown.

View File

@ -23,38 +23,42 @@
\item \item
4: False (== for objects checks for reference equality) 4: False (== for objects checks for reference equality)
\item \item
5: False (it is indeed implemented by default - i.e.~in Object, but 5: False (it is indeed implemented by default - more precisely implemented
the default implementation checks reference equality only) in Object - but the default implementation checks reference equality only)
\item \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 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 \item
7: False (the class is not public) 7: False (the class itself is not public)
\item \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 \item
9: True (the constructor to implement must explicitly call Tiger's 9: True (the constructor to implement must explicitly call \texttt{Tiger}'s
constructor with super) constructor with \texttt{super})
\item \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} \end{itemize}
\section{Exercise B} \section{Exercise B}
\begin{itemize} \begin{itemize}
\item \item
1: False (the only `collection' data structure based over an unboxed 1: False (the only ``collection'' data structure based over an unboxed
primitive type is the array) primitive type is the array -- however arrays are not \texttt{java.util}
collections)
\item \item
2: True (if the hashCode() return value changes after the mutation then the 2: True (if the \texttt{hashCode()} return value changes after the mutation
implementation of hashMap is unable to recognize it was inserted previously) then the implementation of hashMap is unable to recognize it was inserted
previously)
\item \item
3: True 3: True
\item \item
4: True 4: True
\item \item
5: False (finally blocks are always evaluated) 5: False (\texttt{finally} blocks are always evaluated)
\end{itemize} \end{itemize}
\section{Exercise C} \section{Exercise C}