简体   繁体   中英

How to reference a subarray of a two dimensional array as a single dimensional array in java

我有一个二维数组myArray [a] [b],这是Java中引用单维数组myArray [a] [2]的最优雅的方法。

If I understood question correctly, this is it

    int a[][] = {{1,1,1},{2,2,2}, {3,3,3}};
    int[] a2 = a[2];

,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM