Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java double casting (int[]) (int[])

Tags:

java

casting

What does (int[]) (int[]) do ?

private Object[] slots = new Object[8192];

int[] block = (int[]) (int[]) this.slots[0];
like image 394
Lydon Ch Avatar asked Feb 23 '26 12:02

Lydon Ch


1 Answers

In this case, the second cast does nothing. It is the same as typing

private Object[] slots = new Object[8192];

int[] block = (int[]) this.slots[0];
block = (int[]) block;

EDIT:

To clarify, the "second" cast that I am referring to is the one on the left.

like image 94
Bort Avatar answered Feb 25 '26 00:02

Bort