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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:28:54+00:00 2026-06-05T07:28:54+00:00

Just a quick question – if I instantiate a new two dimensional int array

  • 0

Just a quick question – if I instantiate a new two dimensional int array like so

int[][] input = new int[101][]; //number is irrelevant

eclipse seems to not mind this, but I’m not entirely sure if this would work like I’m expecting it to, which is that the second part of the array would act dynamically.

after reading your answers, I realise that my question is badly worded.

I am reading in from a file – it is a CSV and there is 101 columns and X amount of rows. Since I am reading the file in line-by-line, it is simple for me to figure out that the first dimension of my “2-d array” is 101. But, also because I am reading the file line-by-line, I cannot say for certain that my second dimension will be X without iterating through the entire file.

How would I find X using my current method, or is that actually impossible?

  • 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-06-05T07:28:56+00:00Added an answer on June 5, 2026 at 7:28 am

    Then you’d have 101 elements in input which are all null. To create the second dimension, you’d need to initialize it for every item:

    input[13] = new int[63];
    input[14] = new int[128];
    

    The second dimension doesn’t need to be the same for all first level items. The second dimension would be the same if you used this:

    int[][] input = new int[101][50];
    

    All values would then be initialized to 0.

    But the real answer is: Why didn’t you just try?

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

Sidebar

Related Questions

Just a quick question. I'm using something like this FileStream fs = new FileStream(fileName,
Just a quick question. Say a call a method like so mysql_pconnect(server,tator_w,password) or die(Unable
just a quick question. I wonder how many characters count for \n (new line
Just a quick question.. I am trying to generate an text input where the
Just a quick question.. Out of two options mentioned below, how to store to
Just a quick question, when I do request = Net::HTTP::Post.new(path) Can I do path
Just a quick question and I hope that hasn't been asked before. I want
Just a quick question, where do I put the exe that I am trying
just a quick question about the mvc JqueryUI framework, i have a _layout.cshtml page
Just a quick question about ReadWriteLocks in Java (specifically the ReentrantReadWriteLock implementation) as I

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.