class Person {
|
|
public String name;
|
|
public int age;
|
|
public Person(String n, int a) {
|
|
this.name = n;
|
|
this.age = a;
|
|
}
|
|
public String describe() {
|
|
return this.name + " is " + this.age + " years old";
|
|
}
|
|
}
|
|
Person p = new Person("Alice", 30);
|
|
p.name
|
|
p.age
|
|
p.describe()
|
|
int compute(int x,
|
|
int y,
|
|
int z) {
|
|
return x + y + z;
|
|
}
|
|
compute(1, 2, 3)
|
|
%quit
|