CECS 478 Lecture 12: Objects and Classes
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.