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 fruits with {"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
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