CS 121 Lecture 20: Writing Classes

14 views4 pages

Document Summary

All these classes are defined in java api. Each class provides a different group of services. Testing class: contains the main method is just the starting point of a program. Another type of classes represents objects w/ well-defined characteristics & functionality. These classes are the foundation of true object-oriented programming. Classes & objects: (class definition/blueprint; object . We can instantiate as many objects as we need. Every object has its state & primary behavior: ex: consider a 6-sided die, its state can be defined as which face is showing, its primary behavior is that it can be rolled. We represent a die by defining a class called die that models the state and behavior. Classes: a class can contain data declarations & method declarations. A: we might declare an integer variable called facevalue that represents the current value showing on the face of the die.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions