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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:03:22+00:00 2026-05-23T06:03:22+00:00

Considering I have two arrays for example: String[] array1 = new String[10]; int[] array2=

  • 0

Considering I have two arrays for example:

String[] array1 = new String[10];
int[] array2= new int[10];

So that inside a method I’ve computed two arrays, namely array1 & array2
and now I want to return both of these arrays. How should I go about it?

I read here that I can make another class and define certain object types and encapsulate these arrays in that class constructor, but I’m still confused and did not understand completely.

If you could show me a working example which does that, or may be any similar idea, it would be good.

  • 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-23T06:03:23+00:00Added an answer on May 23, 2026 at 6:03 am

    You can actually return something like this also:

    return new Object[]{array1, array2};
    

    And let’s say outside where you call this method your returned object is obj. Then get access to array1 as obj[0] and access array2 as obj[1] (proper casting will be needed).

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

Sidebar

Related Questions

Logging can get complicated, quickly. Considering that you have some code, how do you
I have this small code library that I'm considering releasing into Open Source. I
I'm considering integrating some D3D code I have with WPF via the new D3DImage
I am considering whether it is better to have two pointers, one for each
Let's say that I have two .Net applications running on a single machine. Both
Say I have two lists val L1 = List[(Int, Int)]((1,1), (2,2)) val L2 =
Considering you have an MVVM Architecture in WPF like Josh Smith's examples How would
I have been considering taking the plunge and installing Linux on my Playstation 3.
I'm considering the following: I have some data stream which I'd like to protect
I'm considering using Annotations to define my Hibernate mappings but have run into a

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.