com.perisic.shadow.example.mains
Class Simple
java.lang.Object
com.perisic.shadow.example.mains.Simple
- public class Simple
- extends java.lang.Object
This example does not uses shadows.
It serves as a starting point for the following examples.
The course of action is as follows:
- Two objects (fabian, tomislav) are instantiated.
- Fabian smiles.
- Fabian tells Tomislav a joke making him smile.
Note that all methods are called via the call.(...) Syntax.
Basically foo.bar(arg1, arg2, ...)
is equivalent of
foo.call("bar", arg1, arg2, ...)
. The latter form is
neccessary to enable shadowing.
public class Simple{
public static void main(String [] args) {
NiceFellow fabian = new NiceFellow("Fabian");
NiceChild tomislav = new NiceChild("Tomislav");
fabian.call("smile",1);
fabian.call("printMood");
tomislav.call("printMood");
System.out.println("");
fabian.call("tellJokeTo", tomislav );
tomislav.printMood();
}
}
- First version: 16.03.2004
-
Copyright: (c) Marc Conrad, 2004
-
See http://perisic.com/shadow for information about this package.
- The com.perisic.shadow library is distributed under the terms of the
GNU Lesser General Public License (LGPL).
- If you require the package under a different licence please contact me.
- disclaimer: The classes are provided "as is".
There is no warranty implied by using the com.perisic.shadow package.
- Note: This class needs Java 1.5 for succesfull compilation. Compile this
class with the command javac -source 1.5
Method Summary |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Simple
public Simple()
main
public static void main(java.lang.String[] args)