Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Created January 23, 2022 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save httpmurilo/9dded421ca7f9f5262a5cb6f1bb9583e to your computer and use it in GitHub Desktop.
Save httpmurilo/9dded421ca7f9f5262a5cb6f1bb9583e to your computer and use it in GitHub Desktop.
Singleton static factory
package io.murilo.school.model;
public class Student {
private static final Student INSTANCE = new Student();
private Student() {
...
public static Student getInstance();
}
private Integer id;
private String name;
private Integer age;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment