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.9 ObjUse-WE4-P1
Subgoals for Calling a Method.
Classify method as
static method or
instance method
If
static, use the class name
If
instance, must have or create an instance
Write (instance / class) dot method name and ( )
Determine whether parameter(s) are appropriate
Number of parameters passed must match method declaration
Data types of parameters passed must be compatible with method declaration
Determine what the method will return and where it will be stored
Evaluate right hand side of assignment. Value is dependent on methodβs purpose
Subsection 4.9.1
Exercises Exercises
1.
Q11: Click on the method calls of Scanner objects in the following code
Scanner input = new Scanner(System.in);
System.out .print("Enter Your Full Name: ") ;
String fullName = input .nextLine() ;
System.out .print("Enter Your Course Name: ") ;
String courseName = input .nextLine() ;
2.
3.
Q13: Put these lines of code in the proper order to read in a decimal then an integer, in that order.
Scanner input = new Scanner (System.in);
double x = input.nextDouble();
int y = input.nextInt();
You have attempted
of
activities on this page.