# Error convert slice&push from P5.js to Processing

**URL:** <https://discourse.processing.org/t/error-convert-slice-push-from-p5-js-to-processing/7964>\
**Category:** Coding Questions\
**Created:** [January 30, 2019, 4:15pm UTC](https://discourse.processing.org/t/error-convert-slice-push-from-p5-js-to-processing/7964 "2019-01-30T16:15:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![miasoft](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/miasoft/32/1902_2.png) [@miasoft](https://discourse.processing.org/u/miasoft)\
**Post date:** [January 30, 2019, 4:15pm UTC](https://discourse.processing.org/t/error-convert-slice-push-from-p5-js-to-processing/7964/1 "2019-01-30T16:15:03Z")

</div>

I want to convert Pong.js to Processing. I have two error:

```auto
int[] walls=new int[4]; //= [];
//-----------------------
....
//------------------------
void wallAdder() {
  if (millis()-lastAddTime > wallInterval) {
    int randHeight = round(random(minGapHeight, maxGapHeight));
    int randY = round(random(0, height-randHeight));
    // {gapWallX, gapWallY, gapWallWidth, gapWallHeight, scored}
    int[] randWall={width, randY, wallWidth, randHeight, 0}; 
    walls.push(randWall); //here is error - Cannot invoke push(int[]) on the array int[]
    lastAddTime = millis();
  }
}
void wallRemover(int index) {
  int[] wall =new int[walls[index]];
  if (wall[0]+wall[2] <= 0) {
    walls.splice(index, 1); //error - Cannot invoke push(int[]) on the array int[]
  }
}

```

Help, pls!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [January 30, 2019, 4:19pm UTC](https://discourse.processing.org/t/error-convert-slice-push-from-p5-js-to-processing/7964/2 "2019-01-30T16:19:49Z")

</div>

Java arrays don’t have any methods but only those inherited by the Object class:  
[Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html)

Besides, Java arrays can’t have its _length_ changed!

If you need a dynamic-sized container, you’re better off using an ArrayList instead:  
[Processing.org/reference/ArrayList.html](http://Processing.org/reference/ArrayList.html)
