This is as an illustrative example for how Expression Tutor activities could be used in a Java course. The content on this page may not be understandable for someone without significant prior knowledge.
In Java, instance methods are invoked in code like this: .
Assume a variable of type , where is a class that has a method . Here is how we could invoke that method to get our to move to position 12, 6.
Below is a tree representation of the above expression. You can see four nodes. The node pac represents the variable. It has type
Pacman. The nodes 12 and 6 represent the two literals. They have type int. The root node represents the method invocation. It has three children: first, the object on which to invoke the method (pac), and then the two arguments to the method. Given that the method has return type , the root node has type boolean.