i have problem add two array;I am new to java program so i found this one hard.int a[]= {1,2,3,4,5};int b[]= {9,2,4,7,1};I want to add this whole array to my final output will be10, 4, 7, 11, 6
heres the code which does exactly what u want. u may modify it so thatit looks better eg aray sizes should be hardcoded etcthe code is displays the output on the standard outout which is theconsole.public class AddArray{public static void main(String[] args){int a[]= {1,2,3,4,5};int b[]= {9,2,4,7,1};/* I want to add this whole array to my final output will be10, 4, 7, 11, 6*/int c[] = new int[5];for (int i = 0; i < 5; i++){c[i] = a[i] + b[i];}for (int i = 0; i < 5; i++) System.out.println(c[i]);}}