Computer Science, asked by pratikabanerjee, 7 months ago

What is the output of the below Java Code
Snippet int balls[ ]={};
system.out.println(balls.length);​

Answers

Answered by rohitkhajuria90
2

Answer:

0

output of the below Java Code Snippet

int balls[ ]={};

system.out.println(balls.length);

Output

0

Answered by vinod04jangid
0

Answer:

THE OUTPUT IS 0

Explanation:

In Java, the array length is the number of elements that an array can holds. There is no predefined method to obtain the length of an array. We can find the array length in Java by using the array attribute length. We use this attribute with the array name. In this section, we will learn how to find the length or size of an array in Java.

Java provides an attribute length that determines the length of an array. Every array has an in-built length property whose value is the size of the array. Size implies the total number of elements that an array can contain. The length property can be invoked by using the dot (.) operator followed by the array name. We can find the length of int[], double[], String[], etc.

#SPJ3

Similar questions