Command Line Arguments
The arguments which are passed from command prompt is called command line arguments. We are passing command line arguments at the time program execution.
Command Line Arguments program
class sub
{ 
public static void main(String[] args) 
{ 
System.out.println(args.length); 
System.out.println(args[0]); 
System.out.println(args[1]); 
} 
};
Output :
Compilation : Javac Test.java Execution : java Test a b c Output : 3 a b
Var-arg method
1. introduced in 1.5 version.
2. it allows the methods to take any number of parameters.
Syntax:-(only 3 dots)
Void m1(int… a)
print the var-arg elements by using for-each loop.
class Test 
{ 
void m1(int... a) 
{
for (int a1:a) 
{ 
System.out.println(a1); 
} 
} 
public static void main(String[] args) 
{ 
Test t=new Test(); 
t.m1(10,20,30,40); 
} 
} 
Output :
output:10,,20,,30,,40