[go: up one dir, main page]

0% found this document useful (0 votes)
80 views3 pages

CSA Unit 1 Lesson 9 Guided Notes

Uploaded by

saanvirao816
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views3 pages

CSA Unit 1 Lesson 9 Guided Notes

Uploaded by

saanvirao816
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSA Unit 1 Guide

Lesson 9: Writing Methods


Video Notes: Writing a Method
Annotate this method using the vocabulary from the video.

(makes a method accessible from anywhere) (indicates no return value)


Public void square()
{ (used to call a method and

pass parameters)

forward();
turnLeft();
forward();
turnLeft(); (the overall code)
forward();
turnLeft();
forward();
turnLeft();
}

Term Definition Example / Picture / Code

the structure of a method that is


method signature
designed by the programmer.

1
CSA Unit 1 Guide

defines and constrains the data


return type type of the value returned from a
subroutine or method

marks the end of a function and


return specifies the value or values to
pass back from the function

Term Definition Example / Picture / Code

a reserved type used mainly to


void specify that a method does not
return any data type.

Reflection
Question of the Day: How do I write methods for the behaviors I want an object to have?

We can write methods by writing “public void methodName()” as our class header in the main Java
file, and define a subclass afterward if we have multiple Java files

What other methods would you want to add to the PainterPlus class?

2
CSA Unit 1 Guide

I would like to add a TurnRight() method, moveAwayFromBlock() method, and turnAround()


method.

You might also like