DOC PREVIEW
WUSTL CSE 131 - lab0

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Welcome to CSE 131Anatomy of a Java programAnatomy of a Java programAnatomy of a Java programAnatomy of a Java programAnatomy of a Java programWelcome to CSE 131This is a very short exercise that you do as part of Lab 0Review the following slides to learn the anatomy of a Java class program. There is an exercise for you to complete as part of Lab 0 to test your knowledge of these slides. You can repeat the exercise as many times as you need until you are able to recognize the different parts of a Java program.Anatomy of a Java program2•A Java program can have many packages.•Each package contains a set of related classes.•For example, a baseball package might have a Pitcher, Batter, and Scorekeeper class•The name of this package is lab0Anatomy of a Java program3•A class describes the behaviors of an object.•This class is called RobotInstructions•It has just one kind of behavior which is to act•Other objects have more behaviors•For example, a Pitcher might throw a ball, catch a ball, etc.Anatomy of a Java program4•The behaviors in a class are divided into methods•This method is named “act”•A Pitcher might have a method to throw a ball, catch a ball, etc.Anatomy of a Java program5•For a method to do its job, it sometimes needs information•You see here an “incoming parameter” – a “robot” that is provided to the “act” method.•The act method can then issue instructions to the robotAnatomy of a Java program6•This line of code sends a message to an object to tell it to do something•The object here is “robot” – it is the thing we are telling to do something•The method call is “forward” – we are asking the robot to go forward•This method call requires some information – how far forward should it go?•The value of 100 is the outgoing parameter, sent to the forward method, addressed to the


View Full Document

WUSTL CSE 131 - lab0

Documents in this Course
sp14_4

sp14_4

28 pages

sp14_3

sp14_3

29 pages

sp14_2

sp14_2

43 pages

sp14_10

sp14_10

19 pages

sp14_9

sp14_9

16 pages

sp14_8

sp14_8

22 pages

sp14_7

sp14_7

33 pages

sp14_6

sp14_6

27 pages

sp14_5

sp14_5

55 pages

lecture1

lecture1

33 pages

Load more
Download lab0
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lab0 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lab0 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?