DOC PREVIEW
TRINITY CSCI 1311 - Interacting with Objects
Pages 10

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 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 10 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 10 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Interacting with Objects1/16/2009Opening Discussion●Have you come up with any questions about the class since last time?●Minute essay responses:–Do I give A's?–What will we be doing with Excel?–Can you succeed in this class coming in with little knowledge of computers?–It was good to hear that my efforts on first-year move-in day have finally paid off.Greenfoot●Let's run Greenfoot and open up the Wombats scenario.●Greenfoot environment has several parts to it.–Shows a 2-D graphical display in the main area. –Elements that make things active at at the bottom.–List of different classes are on the right.Classes and Objects●Java is a class-based object-oriented programming languages. We write classes and those are the blueprints for making objects.●Greenfoot groups different classes: World, Actor, Others.●We can tell Greenfoot to make a new object from a class either with a right-click or holding shift.Methods●Classes have methods in them and these methods can be called on the objects of that class.●Right click on “wombatWorld” at the top to call a method on the WombatWorld object. Right click on one of the objects to call a method on it.●Methods can cause things to happen or give us back information.Parameters and Return Types●Some methods need extra information. This is passed in through parameters.–The setDirection method in Wombat needs to be told a direction.●Some methods give you back information.–The getLeavesEaten method in Wombat tells you how many leaves have been eaten.●The “signature” of a method begins with the return type then has the method name and an argument list in parentheses.Types●If you go through all the options on the Wombat when you right click you will see a number of different types.–int: for numbers that don't have fractions.–boolean: either true of false.–String: any text you want.–GreenfootImage and World: types specific to Greenfoot.●Other types include double and char.●Classes define types.Act and Run●At the bottom of the window is an area that has a few buttons. All the actors in Greenfoot have a method called act.●Clicking the Act button calls that method on all the actors.●Clicking Run will repeatedly call the act method.Member Data●Objects can hold information as well. These are called members.●You can look at what is stored by an object by selecting inspect from the right-click menu.●Arrows are drawn when members store other objects. In Java object types are often called reference types.Minute Essay●Do you have any questions about the topics we discussed


View Full Document

TRINITY CSCI 1311 - Interacting with Objects

Course: Csci 1311-
Pages: 10
Documents in this Course
Arrays

Arrays

12 pages

Arrays

Arrays

10 pages

Applets

Applets

5 pages

Arrays

Arrays

8 pages

Methods

Methods

12 pages

Drawing

Drawing

8 pages

Load more
Download Interacting with Objects
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 Interacting with Objects 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 Interacting with Objects 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?