Created
June 26, 2018 16:21
-
-
Save iafisher/16d7bd6c3a0947a9a374ee691b186e75 to your computer and use it in GitHub Desktop.
Minimal example of instantiating and using objects of a static inner class
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
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