Created
July 29, 2012 14:27
-
-
Save practicingruby/3199223 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A { | |
| private B b; | |
| private C c; | |
| private D d; | |
| private E e; | |
| public A () { | |
| b = new B (); | |
| c = new C (); | |
| d = new D (); | |
| e = new E (); | |
| } | |
| public void badStyle() { | |
| b.getD().getE().display(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class B { | |
| private C c; | |
| private D d; | |
| public B () { | |
| c = new C (); | |
| d = new D (); | |
| } | |
| public D getD() { | |
| return d; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class C { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class D { | |
| private E e; | |
| public D () { | |
| e = new E (); | |
| } | |
| public E getE() { | |
| return e; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class E { | |
| public void display() { | |
| System.out.println("Hello from E!"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Main { | |
| public static void main (String[] args) { | |
| A a = new A (); | |
| a.badStyle(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment