MARKET 1 Lecture Notes - Lecture 6: Cartesian Coordinate System, Mathematical Notation, Substring
Document Summary
Definition: a collection of data that provides a set of methods, example: a string is a collection of characters that provides methods like charat and substring. Its purpose is to identify which variable you are referring to unambiguously: use the point object: import java. awt. point; Point blank; blank = new point(3, 4); //coordinates to the. Point blank; blank = new point(3, 4); int sum = blank. x + blank. y; System. out. println( the coordinates are blank. x + , + blank. y + . ); System. out. println( the sum of the coordinates is + sum + . ); The sum of the coordinates is 7: rectangle, a rectangle is similar to a point, but they have four attributes: x, y, width, and height, use the rectangle object: import java. awt. rectangle; //creates point named blank box = new rectangle(0, 0, 100, 200); Point objects provide a method called tostring that returns a string representation of a point.