1 / 7

Understanding Java Methods and Data Types through Wombat and Leaf Classes in Greenfoot

Dive into the fundamentals of Java programming by exploring the Wombat and Leaf classes in Greenfoot. This guide covers the significance of methods, data types, and constructors with practical examples. Learn how to reverse-engineer the Wombat class, understand variable types such as integers, floats, and booleans, and grasp the essential syntax, including comments for code clarity. By working through these concepts, you'll enhance your programming skills and gain confidence in using Java for creating engaging scenarios.

alain
Télécharger la présentation

Understanding Java Methods and Data Types through Wombat and Leaf Classes in Greenfoot

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Methods, Data and Data Types Chapter 1-3

  2. Wombat and leafs • Open up greenfootWombatWorld scenario • Lets reverse engineer Wombat class • Lets look at methods and data of this class? How and where?

  3. Java language syntax • Comments: You can add comments to your program to explain the code // single line comment /* multiple line comment */ • Constructor is a special method that has the same name as the class; it has no return value

  4. Data Types • Whole numbers: represented by : int • Example: intnumStudents; • Real numbers, numbers with fractional components, floating point numbers:float, double • Example: floatbodyTemp; doublesizeOfAtom; doubledistanceToMars; • Logic variable that holds true or false values: boolean • Example: boolean raining; // true or false

  5. Wombat Class

  6. Leaf Class

  7. We will do the 10 things next class.

More Related