There is lots of source code on the forum in various threads.
Type: Posts; User: Norm
There is lots of source code on the forum in various threads.
I guess I assumed that you were asking how to call a method.
Now I see you are trying to define a method.
See the tutorial for all the details:
Defining Methods (The Java™ Tutorials > Learning...
Calling a method and extending a class (subclassing) are two completely different things.
1) this refers to the current instance of the class
2) Try it and see what is printed.
That was a simple example not meant to have any realistic code.
An example
class SomeClass {
int someVar = 33; // class variable
void someMethod() {
int someVar = 0; // a variable that shadows the class variable
...
int x =...