Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java anonmyous array eg


public class Main
{
	public static void main(String[] args) {
		sum(new int[] {2,4,6,8,10});
      //we can't define size of anonymous array
		
	}
	
	static void sum(int[] arr){
	 int sum=0;
	 for(int i:arr){
	     sum+=i;
	 }
	 System.out.println(sum);
	   
	}
}
 
PREVIOUS NEXT
Tagged: #java #anonmyous #array
ADD COMMENT
Topic
Name
2+7 =