CECS 478 Lecture 12: Objects and Classes

38 views1 pages

Document Summary

Objects: entities in your program that you can manipulate by calling methods. Methods: sequences of instructions that access the data of an object. Classes: describe a set of objects with the same behavior. Example: rectangle class: consists of objects of type rectangle, describes rectangular shape, contains a asset of numbers that describe the rectangle, not physical shape import java. awt. rectangle; public class shape public static void main(string [] args) { Rectangle box = new rectangle(5, 10, 15, 20, 30); This will print information about the dimensions of the rectangle, but not a rectangle. String 1 and string 2 are now equal except string 2 will be in all caps. Instance variables: store the data of an object. Example: create an object of bankaccount class.

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