fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. new Ideone();
  14. }
  15. public Ideone() {
  16. A a = new A();
  17. System.out.println("ex1");
  18. a.f(1234);
  19. System.out.println("ex2");
  20. a.f(54321, "first", "second");
  21. }
  22.  
  23. class A {
  24. void f(int a, Object... os) {
  25. System.out.println("int: " + a);
  26. System.out.println("Objects is null?: " + (os == null));
  27. if (os != null) {
  28. System.out.println("Objects length: " + os.length);
  29. for (Object o: os) {
  30. System.out.println("\t" + o);
  31. }
  32. }
  33. }
  34. }
  35. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
ex1
int: 1234
Objects is null?: false
Objects length: 0
ex2
int: 54321
Objects is null?: false
Objects length: 2
	first
	second