Skip to content

Instantly share code, notes, and snippets.

@delor
Created May 26, 2017 09:53
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 delor/c7bac3351176f7d8e0d4b5aea20d60b7 to your computer and use it in GitHub Desktop.
Save delor/c7bac3351176f7d8e0d4b5aea20d60b7 to your computer and use it in GitHub Desktop.
You don't need to use new keyword anymore. ;)
package example;
public class Example {
private final int a;
private Example(int a) {
this.a = a;
}
public static Example Example(int a) {
return new Example(a);
}
public static void main(String[] args) {
Example example = Example(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment