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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:57:08+00:00 2026-05-19T13:57:08+00:00

Is it possible to dynamically declare arrays or variables after compilation? I ask because

  • 0

Is it possible to dynamically declare arrays or variables after compilation? I ask because it is the only way I can think to solve this problem I’ve been running in to.

What I am trying to do is take an arbitrarily large set of numbers, find the midrange, and divide that set into two smaller subsets. Kinda like a quicksort (which I have no idea how to implement by the way).

The reason I believe Ill need to be able to declare these datatypes after compilation is because I want to be able to create an arbitrary amount of subsets as well, based off user input.

So, for example if the user specifies 8 levels then the program should be able to divide the original set with the method described above, and repeat that with all the subsequent subsets. It appears, to me that in order to organize the numbers in this way would require the use of arrays, hence the problem I’m running into.

Is there a simpler way to approach this problem? If there is I’d really appreciate some insight. And if not, how can I do what I described above?

To clarify, I am writing this program in Java, and no, this is not a homework assignment.

Thanks a bunch.

  • 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-19T13:57:09+00:00Added an answer on May 19, 2026 at 1:57 pm

    You can do this with a 2D array (which is an array of arrays). This initial declaration might be:

    int[][]  array;
    

    When you know how many subarrays you’ll need, you can create the array with one known dimension:

    array = new int[8][];
    

    You have now created an array that can hold 8 subarrays of type int[], but the subarrays don’t yet exist. To create one, you can do this:

    array[0] = new int[15];
    array[1] = new int[12];
    // etc.
    

    Note that each subarray can be of a different size if you want.

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

Sidebar

Related Questions

So as to use cursors dynamically using MySQL is it possible to declare a
Is it possible to dynamically create and modify images on a per pixel level
Does someone knows if it's possible to dynamically create a call chain and invoke
Possible Duplicate: Change CSS Dynamically I need to change the height of a div
Is it possible to check if a dynamically loaded assembly has been signed with
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
Is it possible to specify the parent of a class when I instantiate/declare that
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the

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.