Java变化的参数数量


Java变化的参数数量

public class Sample{

   void demoMethod(String... args) {

      for (String arg : args) {

         System.out.println(arg);

      }

   }

   public static void main(String args[] ){

      new Sample().demoMethod("ram", "rahim", "robert");

      new Sample().demoMethod("krishna", "kasyap");

      new Sample().demoMethod();

   }

}