public class Example1 { // INSTANCE VARIABLES // AVAILABLE TO ALL METHODS, EXCEPT MAIN int number = 11; // "void" in the header line indicates that the method does not have a return statement public void doThis() { System.out.println("number: " + number); number++; System.out.println("number: " + number); } public void doThis2() { // USE A LOCAL VARIABLE: // it will be used only within this method // it must be initialized before being used String name = "Joe Bloggs"; int x = 8; } // "int" in the header line indicates that the method returns an integer public int sendNumber() { return number * 2; } public static void main(String[] args) { Example1 e = new Example1(); e.doThis(); // this line has an example of storing a result returned by a method: int result = e.sendNumber(); System.out.println("result: " + result); } }