fork download
  1. import java.util.Arrays;
  2.  
  3. class Example
  4. {
  5. Example(String... strings) {
  6. System.out.println("strings = " + Arrays.toString(strings));
  7. // Obviously, in the normal case, a constructor actually does something
  8. // with the parameters...
  9. }
  10.  
  11. static Example create(String... strings) {
  12. return new Example(strings);
  13. }
  14.  
  15. public static void main(String[] args)
  16. {
  17. Example e = Example.create("a", "b", "c");
  18. }
  19. }
Success #stdin #stdout 0.08s 27772KB
stdin
Standard input is empty
stdout
strings = [a, b, c]