alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (T5003235b.java)

This example Java source code file (T5003235b.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

access, inner, outer

The T5003235b.java Java example source code

/*
 * @test  /nodynamiccopyright/
 * @bug     5003235
 * @summary Accessibility of private inner class
 * @author  Peter von der Ah\u00e9
 * @compile/fail/ref=T5003235b.out -XDdiags=%b:%l:%_%m T5003235b.java
 */

class Outer {
    public Inner inner;

    public void create() {
        inner = new Inner();
    }

    private class Inner {
        int k = 100;
        protected int l = 100;
        public int m = 100;
        protected int n = 100;
    }
}

class Access {
    public static void main(String[] args) {
        Outer outer = new Outer();
        outer.create();
        System.out.println("Value of k: " + outer.inner.k);
        System.out.println("Value of l: " + outer.inner.l);
        System.out.println("Value of m: " + outer.inner.m);
        System.out.println("Value of n: " + outer.inner.n);
    }
}

Other Java examples (source code examples)

Here is a short list of links related to this Java T5003235b.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.