The enclosing object instance of an inner class can be accessed in Java as described in the following example:

public class EnclosingClass {

    private int number = 12;

    public void callInnerMethod() {

       InnerClass inner = new InnerClass();

    class InnerClass {
        public void printNumber() {

    public static void main(String[] args) {
        EnclosingClass enclosingObject = new EnclosingClass();

When this code is run, 12 will be printed to the screen.