


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















cs402 - Spring 2003
cs402 - Spring 2003
optAccessQualifier
returnType
methodName
(^
optArgumentList
)^
optThrowsClause
{
…^ //
statements }
cs402 - Spring 2003
… // Statements} void someMethod() {int i = totalCalories();
//same as i =
this
.totalCalories()
}
cs402 - Spring 2003
int i = apple.totalCalories(); // tell what object to use }
cs402 - Spring 2003
BinaryTree
private
Object
nodeData;
private
Tree
left;
left
sub-tree
private
Tree
right;
right
sub-tree
cs402 - Spring 2003
static
cs402 - Spring 2003
Ex:Employee
newhire
new
Employee();
newhire.total_employees=1;
reference
through
the
instance
Employee.total_employees=1;
reference
through
the
class
cs402 - Spring 2003
Ex:class
Employee
String
name; int
salary; int
employee_id; static
int
total_employees;
static
void
clear()
total_employees
cs402 - Spring 2003
cs402 - Spring 2003
static
cs402 - Spring 2003
cs402 - Spring 2003
cs402 - Spring 2003
final
MyClass c) {
c.field = 7; // Okc = new MyClass(); //compilation error }
cs402 - Spring 2003