int, float, and double
are basic primitive types.
There are other primitive types also: boolean,
char, etc.
+,
-, *, /, etc.)
int radius = 2;
int diameter = radius * 2;
double pi = 3.14159;
double area = pi * radius * radius;
To find out what methods are available for a class, look at its class documentation.
Clock Fish Greeter getHour() getMinute() moveForward() turnAround() swimUp() sayHello()
object.methodName() e.g., myClock.getHour()
Methods always include parentheses. If the
method needs the user to pass some information to it, that
information goes inside the parentheses.
new keyword and the
constructor.
Fish fish1 = new Fish();
fish1.moveForward();
fish1.swimUp();