004-007-004
Array Length: The length Property
Easy
Problem Description
Array Length: The length Property
Learning Objective: Understand how to get the number of elements using the length property
Overview
The number of elements in an array can be obtained using the .length property. It returns the size determined at array declaration.
Specifications
- Initialize String array
fruitswith {"Apple", "Banana", "Orange", "Grape"} - Get the element count using length property
- Output the array content and element count
Output Format
Fruits: Apple, Banana, Orange, Grape
Count: 4
Test Cases
※ Output examples follow programming industry standards
Input:
Expected Output:
Fruits: Apple, Banana, Orange, Grape Count: 4
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
