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 7410167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:11:34+00:00 2026-05-29T06:11:34+00:00

I am going through the Oracle tutorials on Java and there is one thing

  • 0

I am going through the Oracle tutorials on Java and there is one thing I do not understand so far. This is why the outcome of the arrays is what is shown.

The code is:

public static void main (String [] args){

      String[][] names = {
                {"Mr. ", "Mrs. ", "Ms. "},
                {"Smith", "Jones"}
            };
            // Mr. Smith
            System.out.println(names[0][0] +
                names[1][0]);
            // Ms. Jones
            System.out.println(names[0][2] +
                names[1][1]);
        }   

I understand that Mr gets printed out as the index is 0. But smith gets printed out when it is [1][0], and also I understand how Ms is printed out because the index is 2. But I do not understand how Jones is printed out.

What I don’t understand is how the multidimensional arrays use the indexes.

Please correct me if I am wrong but do multidimensional arrays work like rows? So the first array would be 0 and the next array would be 1 and so on?

Which is why [1] which is the second array and [0] is equal to “Smith” because it is the index 0?

  • 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-29T06:11:35+00:00Added an answer on May 29, 2026 at 6:11 am
    String[] titles = names[0]; // {"Mr. ", "Mrs. ", "Ms. "}
    String[] lastNames = names[1]; // {"Smith", "Jones"}
    

    But I do not understand how Jones is printed out.

    The first index of names selects the String array to pick from, while the second index is the element of that array that is picked.

    Just as "Smith" is lastNames[0], which is names[1][0], "Jones" is lastNames[1], which is the same as names[1][1].

    Please correct me if I am wrong but does multidimensional arrays work like rows. So the first array would be 0 and the next array would be 1 and so on?

    Which is why [1] which is the second array and [0] is equal to "Smith" because it is the index 0?

    This is correct.

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

Sidebar

Related Questions

I was going through TypeErasure topic at http://download.oracle.com/javase/tutorial/java/generics/erasure.html which says that compiler removes all
Im going through a log file using php and it looks either like this:
I believe there is a way to do this, but I'm not familiar with
Going through my code, I was hoping to remove instances where I do this:
I'm interested in becoming more fluent in Java so I have been going through
After going through the discussion here I have one more question now. Lets assume,
I'm going through some code that uses the Oracle OCI and I've come across
While going through MSDN I found that in button properties useSubmitBeheviour there is written
while going through video tutorials for mvc2 which i downloaded from microsoft's website, the
I am going through a tutorial where so far it gives you the code

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.