I dont want to modify the cellMap it's the reason why cellMap is final

Since you want to make it final. You can set it's value via the constructor:

Copyclass MapEntity
{
    private final ICellEntity[][] cellMap;

    public MapEntity(ICellEntity[][] cellMap){
        this.cellMap = cellMap;
    }
}

You can create an initialized cellMap array first, then pass it via the constructor to set the cellMap's value within MapEntity.

Copy//Initialize your cellMap else where first
ICellEntity[][] cellMap = new CellEntity[width][length];
for(int x=0; x<width; x++)
    for(int y=0; y<length; y++)
        cellMap[x][y] = new CellEntity();

//Pass in the initialized cellMap via the constructor
MapEntity mapEntity = new MapEntity(cellMap);

I want to know if there's a solution to invoke (to force) a method in CellEntity class in order to init each CellEntity in the cellMap?

Well, if your cellMap was declared as final, there is no way you can set it via a method (accessor), other than probably using reflection (which I don't think you will like it very much).

Answer from user3437460 on Stack Overflow
🌐
W3Schools
w3schools.com › java › java_arrays_multi.asp
Java Multi-Dimensional Arrays
To create a two-dimensional array, write each row inside its own curly braces: ... To access an element of a two-dimensional array, you need two indexes: the first for the row, and the second for the column.
🌐
Scaler
scaler.com › home › topics › two dimensional array in java
Two Dimensional Array In Java with Examples - Scaler Topics
June 8, 2024 - We can declare a 2D array in Java ... of objects. A two-dimensional array of objects in Java is simply a collection of arrays of several reference variables....
🌐
Codecademy
codecademy.com › learn › learn-java › modules › java-two-dimensional-arrays › cheatsheet
Learn Java: Two-Dimensional Arrays Cheatsheet | Codecademy
In Java, 2D arrays are stored as arrays of arrays. Therefore, the way 2D arrays are declared is similar 1D array objects.
🌐
freeCodeCamp
freecodecamp.org › news › 2d-array-in-java-two-dimensional-and-nested-arrays
2D Array in Java – Two-Dimensional and Nested Arrays
August 10, 2022 - A multidimensional array is simply an array of arrays. You can look it as a single container that stores multiple containers. In this article, we'll talk two dimensional arrays in Java.
🌐
Runestone Academy
runestone.academy › ns › books › published › apcsareview › Array2dBasics › a2dDAS.html
10.3. Declaring 2D Arrays — AP CSA Java Review - Obsolete
To declare a 2D array, specify the type of elements that will be stored in the array, then ([][]) to show that it is a 2D array of that type, then at least one space, and then a name for the array. Note that the declarations below just name the variable and say what type of array it will reference.
🌐
Hero Vired
herovired.com › learning-hub › topics › two-dimensional-array-in-java
Two-Dimensional Array in Java - Hero Vired
July 29, 2024 - A two-dimensional array of objects in Java is simply a collection of arrays of several reference variables. We can declare a 2D array of objects in the following manner.
Find elsewhere
🌐
Java67
java67.com › 2014 › 10 › how-to-create-and-initialize-two-dimensional-array-java-example.html
How to declare and Initialize two dimensional Array in Java with Example | Java67
You can further see Object-Oriented Java Programming: Data Structures and Beyond Specialization on Coursera to learn more about how to use an array and other data structures in real-world projects. If you want to access each element of a two-dimensional array, then you need to iterate through the two-dimensional array using two for loops. Why? because you need two indexes to access an individual element from the 2D ...
🌐
Programiz
programiz.com › java-programming › multidimensional-array
Java Multidimensional Array (2d and 3d Array)
Here, we have created a multidimensional array named a. It is a 2-dimensional array, that can hold a maximum of 12 elements, ... Remember, Java uses zero-based indexing, that is, indexing of arrays in Java starts with 0 and not 1.
🌐
Coderanch
coderanch.com › t › 389127 › java › initializing-dimentional-objects-array
initializing two dimentional objects array (Beginning Java forum at Coderanch)
July 7, 2001 - I have tested the code below and it is working fine. class test{ public static void main(String ar[]) throws Exception{ Object obj[][] ; // I declare a two dimensional object obj = new Object[20][] ; // creating a 2d array with 20 // rows obj[0] = new Object[2] ; // Zero th row -> 2 columns obj[1] = new Object[3] ; // first row -> 3 columns // Now I can assign values to the array obj[0][0] = "string1" ; obj[0][1] = "String2" ; obj[1][0] = new java.util.Vector() ; obj[1][1] = new java.lang.String("Test") ; obj[1][2] = "String3" ; // like this you can store anything in this array } } Cindy Glass · "The Hood" Posts: 8521 · posted 24 years ago · Number of slices to send: Optional 'thank-you' note: Send ·
🌐
GeeksforGeeks
geeksforgeeks.org › java › multidimensional-arrays-in-java
Java Multi-Dimensional Arrays - GeeksforGeeks
A 2D array represents data in rows and columns. It can be understood as an array of 1D arrays. ... A 2-D array can be seen as a table with 'x' rows and 'y' columns where the row number ranges from 0 to (x-1) and column number ranges from 0 to ...
Published   March 14, 2026
🌐
Processing
processing.org › tutorials › 2darray
Two-Dimensional Arrays / Processing.org
// 2D Array of objects Cell[][] grid; // Number of columns and rows in the grid int cols = 10; int rows = 10; void setup() { size(200,200); grid = new Cell[cols][rows]; for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { // Initialize each object grid[i][j] = new Cell(i*20,j*20,20,20,i+j); } } } void draw() { background(0); // The counter variables i and j are also the column and row numbers and // are used as arguments to the constructor for each object in the grid.
🌐
Runestone Academy
runestone.academy › ns › books › published › csawesome › Unit8-2DArray › topic-8-1-2D-arrays-Day1.html
8.1.1. 2D Arrays (Day 1) — CSAwesome v1
To declare a 2D array, specify the type of elements that will be stored in the array, then ([][]) to show that it is a 2D array of that type, then at least one space, and then a name for the array. Note that the declarations below just name the variable and say what type of array it will reference.
🌐
iO Flood
ioflood.com › blog › 2d-array-java
2D Array in Java: Configuring Two-Dimensional Arrays
February 27, 2024 - The elements of an array are stored ... of multidimensional array is the two-dimensional array, or 2D array, which is essentially a grid of values....
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › two-dimensional array in java
Two-Dimensional Array in Java | Syntax & Example Program
September 2, 2025 - A two-dimensional array in Java is an array of arrays that stores data in rows and columns. It’s ideal for representing matrices, tables, and grid-like structures in both programming logic and data storage.
🌐
Carnegie Mellon University
cs.cmu.edu › ~mrmiller › 15-110 › Handouts › arrays2D.pdf pdf
Two-Dimensional Arrays 15-110 Summer 2010 Margaret Reid-Miller
• Each element in the 2D array must by the same type, • either a primitive type or object type. • Subscripted variables can be use just like a variable: ! rating[0][3] = 10;! • Array indices must be of type int and can be a · literal, variable, or expression. rating[3][j] = j;! • If an array element does not exists, the Java ...
🌐
Runestone Academy
runestone.academy › ns › books › published › csjava › Unit9-2DArray › a2dSummary.html
9.3. 2D Arrays Summary — CS Java
A two dimensional array stores objects in a 2d table. You can think of it as storing objects in rows and columns, but it actually uses an array of arrays to store the objects as shown below. In this chapter you learned how to declare 2d arrays, create them, and access array elements.
🌐
Software Testing Help
softwaretestinghelp.com › home › java › multidimensional arrays in java (2d and 3d arrays in java)
MultiDimensional Arrays In Java (2d and 3d Arrays In Java)
April 1, 2025 - A two-dimensional array stores an array of arrays of elements and uses two indices to access its elements. ... Answer: Two-dimensional means having only two dimensions. In a geometric world, objects that have only height and width are ...