Class: a program entity that represents either:
1. A program/module
2. A type of objects
- A class is a blueprint or template for constructing objects
- EX: The String class (type) is a template for creating many
String objects(instances).
Object: An entity that contains data and behavior.
- data: variables inside the object
- behaviour: methods inside an object
*You interact with the methods; the data is hidden in the
object.
->Constructing /9creating) an object:
Type objectName = new Type(parameters);
->Calling an object's method:
objectName.methodName(parameters);
String: An object storing a sequence of text characters.
-Unlike most objects, a String is not created with new.
String name = "text";
String name = expression;
-EX:
String name = “Marla Singer”;
Int x = 3;
Int y = 5;
String point = “(“ + x +”, “ + y +”)”;