Computer Applications
Give the output of the following:
int m[] = {2,4,6,8};
System.out.println(m[1] + " " + m[2]);
Java
Java Arrays
116 Likes
Answer
4 6
Working
m[1] gives the second element of the array which is 4
m[2] gives the third element of the array which is 6
Answered By
59 Likes
Related Questions
Give the output of the following:
int a[] ={2,4,6,8,10}; a[0]=23; a[3]=a[1]; int c= a[0]+a[1]; System.out.println("Sum = "+c);
Give the output of the following:
int a[]=new int [5]; a[0]=4; a[1]=8; a[2]=7; a[3]=12; a[4]=3; System.out.println(a[2+1]);
Give the output of the following:
int a[4]={2,4,6,8}; for(i=0;i<=1;i++) { s=a[i]+a[3-i]; System.out.println(s); }