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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:55:42+00:00 2026-06-14T17:55:42+00:00

I instantly apologize if this question is incredibly easy to answer, but I’ve never

  • 0

I instantly apologize if this question is incredibly easy to answer, but I’ve never dealt with Java before, and I don’t even know how to phrase this question properly. Let’s assume the following piece of code (in Java):

byte[] arrayOfBytes1;
int i = 16;
arrayOfBytes1 = new byte[i];

byte[] arrayOfBytes2 = arrayOfBytes1;

So my question is, what would arrayOfBytes2 actually be? Is it going to be an independent copy of arrayOfBytes1, or it’s going to reference it? Thanks in advance.

P.S. Oh, and if someone can provide C/C++ analogue it would be incredibly helpful.

  • 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-14T17:55:43+00:00Added an answer on June 14, 2026 at 5:55 pm

    It’s going to be a reference to it, so you’ll save yourself a lot of confusion by doing the following instead:

    byte[] arrayOfBytes2 = arrayOfBytes1.clone();
    

    That way you’ll get an independent copy of the initial array.

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

Sidebar

Related Questions

I find java starts up and runs practically instantly for me - but javac
I apologize in advance for asking such a silly question, but I can't seem
Weired problem! ASP.NET Session expires instantly. In my web.config I have this session settings:
When I click Settings in my application's menu, app crash instantly. I don't have
I have this link: <a href=data:application/pdf;base64,JVBERi0x...KJSVFT0YK>PDF</a> In Safari on MacOsX, clicking the link instantly
this code gives an instant seg fault,I tried placing printf's all over, I even
First off, let me apologize if I'm writing this in the wrong place. I
I am trying to implement the GJK-algorithm but I got stuck instantly. The problem
NOTICE This is a rather large question, so please bear with me and I
I apologize if link is not the exact term for this in advance. 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.