Predict the output public static void main(String[] args) { int[] arr, arr = new int[5]; arr[4]=40; System.out.println(arr[2]) System.out.println(""+arr[4]:
Answers
Answered by
12
Answer:
0 40
Explanation:
Answered by
0
Answer:
the output of this signal is:
0
40
Explanation:
In Java, an array is an object that holds components of the same data type. Furthermore, the elements of an array are held at a single memory address. It is a data structure where we save comparable objects; nevertheless, a Java array can only carry a limited number of items.
The Java code provided is,
SumOfArray is a public class.
main(String[] args) int[] arr-new int[11.2.3.4]; public static void main(String[] args) int[] arr-new int[11.2.3.4
int sum = 0;
(int i=0arr length:++) for
{|||||
sum=sum+arl}}}
System.out.println("Sum of all RTY elements"-sum)
#SPJ3
Similar questions
Political Science,
3 hours ago
Computer Science,
3 hours ago
Math,
3 hours ago
Physics,
5 hours ago
Physics,
5 hours ago
Math,
7 months ago
Biology,
7 months ago