WUSTL CSE 131 - lab0 (6 pages)

Previewing pages 1, 2 of 6 page document View the full content.
View Full Document

lab0



Previewing pages 1, 2 of actual document.

View the full content.
View Full Document
View Full Document

lab0

130 views


Pages:
6
School:
Washington University in St. Louis
Course:
Cse 131 - Computer Science I
Computer Science I Documents

Unformatted text preview:

Welcome to CSE 131 This is a very short exercise that you do as part of Lab 0 Review 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 program 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 lab0 2 Anatomy of a Java program 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 3 Anatomy of a Java program 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 4 Anatomy of a Java program 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 robot 5 Anatomy of a Java program 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 robot 6



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

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 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?