Skip to main content
Contents
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 4.6 ObjUse-WE3-P1
Subgoals for using objects (creating instances).
Declare variable of appropriate class datatype.
Assign to variable: keyword new, followed by class name, followed by ().
Determine whether parameter(s) are appropriate (API)
Data types of the parameters
Subsection 4.6.1
Figure 4.6.1.
Exercises Exercises
1.
2.
Because we do not have an implementation of the
Widget
class, there is no
import
statement in the ActiveCode box below, and you will not be able to execute the above code.
You have attempted
of
activities on this page.