Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo {
- protected String x = "x";
- public function getX() {
- return x;
- }
- }
- class Bar {
- protected Foo foo;
- public Bar() {
- this.foo = new Foo();
- }
- public Foo getFoo() {
- return foo;
- }
- }
- public static void main(String [] args) {
- Bar bar = new Bar();
- String x = bar.getFoo().getX();
- }
- class Bar {
- protected Foo foo;
- public Bar() {
- this.foo = new Foo()
- }
- public String getFooX {
- return foo.getX();
- }
- }
- public static void main(String [] args) {
- Bar bar = new Bar();
- String x = bar.getFooX();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement