Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SomeClass instance = // ....
- public SomeClass getInstance() {
- return new SomeClass(instance);
- }
- // Option A with a "limiting public interface"
- public interface Awesome {
- public String getText();
- }
- class MyAwesome implements Awesome {
- public String getText() {
- // ..
- }
- // Option B is to make setText non-public
- public void setText() {
- // ..
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement