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
Subsection4.9.1
ExercisesExercises
1.
Q11: Click on the method calls of Scanner objects in the following code
Scannerinput = new Scanner(System.in);System.out.print("Enter Your Full Name: ");
StringfullName = input.nextLine();
System.out.print("Enter Your Course Name: ");
StringcourseName = input.nextLine();
2.
Q12: What data type is returned by calling nextLine for an instance of Scanner? (Reading the code for the previous question may provide a hint for this one!)
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();