Skip to content

Instantly share code, notes, and snippets.

@iafisher
Created June 26, 2018 16:21
Show Gist options
  • Save iafisher/16d7bd6c3a0947a9a374ee691b186e75 to your computer and use it in GitHub Desktop.
Save iafisher/16d7bd6c3a0947a9a374ee691b186e75 to your computer and use it in GitHub Desktop.
Minimal example of instantiating and using objects of a static inner class
import lombok.Data;
public class Enclosing {
@Data
public static class Inner {
private String value;
}
public static void main(String[] args) {
Inner inner1 = new Inner();
inner1.setValue("foo");
Inner inner2 = new Inner();
inner2.setValue("bar");
System.out.println(inner1.getValue()); // prints "foo"
System.out.println(inner2.getValue()); // prints "bar"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment