Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. public class Main{
  2. public static void main(String []args){
  3. Test a = Test.create(1);
  4. System.out.println(a.getId());
  5. }
  6. }
  7. class Test {
  8. private int id;
  9. private Test() {}
  10.  
  11. public static Test create(int id) {
  12. Test t = new Test();
  13. t.id = id;
  14. return t;
  15. }
  16. public int getId() {
  17. return this.id;
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement