2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
21
Task/Call-an-object-method/Processing/call-an-object-method
Normal file
21
Task/Call-an-object-method/Processing/call-an-object-method
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// define a rudimentary class
|
||||
class HelloWorld
|
||||
{
|
||||
public static void sayHello()
|
||||
{
|
||||
println("Hello, world!");
|
||||
}
|
||||
public void sayGoodbye()
|
||||
{
|
||||
println("Goodbye, cruel world!");
|
||||
}
|
||||
}
|
||||
|
||||
// call the class method
|
||||
HelloWorld.sayHello();
|
||||
|
||||
// create an instance of the class
|
||||
HelloWorld hello = new HelloWorld();
|
||||
|
||||
// and call the instance method
|
||||
hello.sayGoodbye();
|
||||
Loading…
Add table
Add a link
Reference in a new issue