Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6125897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:18:08+00:00 2026-05-23T16:18:08+00:00

In Java, is a multidimensional array stored in column-major or row-major order?

  • 0

In Java, is a multidimensional array stored in column-major or row-major order?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:18:09+00:00Added an answer on May 23, 2026 at 4:18 pm

    Java doesn’t have multi-dimensional arrays. It has arrays of arrays. So for instance,

    int[][]
    

    …is an array of int[] (and of course int[] is an array of int).

    Consequently, Java is neither column-major nor row-major order (but see note below about how to read a[2][3]), because while a given array’s entries are stored in a contiguous block of memory, the subordinate arrays those entries point to are object references to completely separate, unrelated blocks of memory. This also means that Java’s arrays of arrays are inherently jagged: The entry at [0] might refer to a 3-slot array, the one at [1] might refer to a 4-slot array, [2] might not refer to an array at all (it could have null), and perhaps [3] refers to a 6-slot array.

    A picture is worth 1k-24 words and all that:

                             +−−−−−−−−+
                       +−−−−>| int[]  |
    +−−−−−−−−−−−+      |     +−−−−−−−−+
    |  int[][]  |      |     | 0: int |
    +−−−−−−−−−−−+      |     | 1: int |
    | 0: int[]  |−−−−−−+     | 2: int |
    | 1: int[]  |−−−−−−+     +−−−−−−−−+
    | 2: null   |      |
    | 3: int[]  |−−+   |     +−−−−−−−−+
    +−−−−−−−−−−−+  |   +−−−−>| int[]  |
                   |         +−−−−−−−−+
                   |         | 0: int |
                   |         | 1: int |
                   |         | 2: int |
                   |         | 3: int |
                   |         +−−−−−−−−+
                   |
                   |         +−−−−−−−−+
                   +−−−−−−−−−| int[]  |
                             +−−−−−−−−+
                             | 0: int |
                             | 1: int |
                             | 2: int |
                             | 3: int |
                             | 4: int |
                             | 5: int |
                             +−−−−−−−−+
    

    Once you know that, you know that (say) a[2][3] means “Get the array referenced by the entry at index 2 of a, then get the entry referenced by index 3 of that subordinate array.” I think of it as fairly similar to row-major order, but it’s not quite the same thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Java serialization of multidimensional array Is there anyway to serialize a 2D array to
How do I make a multidimensional array of generic items in java? Consider the
I have create following string multidimensional array in java. which has top outer array
If it is possible, how can I create a static multidimensional array in Java
java.util.Date gets stored as 2010-09-03 15:33:22.246 when the SQL data type is timestamp, how
how would i write a function in java that generates all the 3*3 multidimensional
I have a multidimensional array built from Strings that is initially created with the
This is basically a restatement of this question: Java: Multi-dimensional array vs. One-dimensional but
When I say a grid, I mean a multidimensional array. I want this because
Is this most efficient method to box/unbox multidimensional primitive arrays in Java without using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.