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

  • SEARCH
  • Home
  • 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 6767001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:53:56+00:00 2026-05-26T14:53:56+00:00

Please what’s the term for methods that alter the contents of a variable, while

  • 0

Please what’s the term for methods that alter the contents of a variable, while not returning anything.

For instance in Java from the java.util.Arrays class the static method sort sorts an array internally and sets the sorted array to the original arrays variable (not sure).

import static java.util.Arrays.sort;
public class bs {
public static void main(String [] args){

    int[] arr = {3,2,4,8,2,5,33,12,19,15,20};
    sort(arr); // doing this stuff <<<< and not int [] arr1 = sort(arr); 
  }
 }

1 – Is there a specific term for that kind of method,

and;

2 – How does this work internally? Does it delete the original variable and assign the sorted values to a fresh one with that same name or??

Thanks!!

  • 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-26T14:53:57+00:00Added an answer on May 26, 2026 at 2:53 pm

    I’d normally call it a mutator – or just talk about it having side-effects. (Usually a mutator is a method you call on an object which changes that object’s state. In this case we’re changing the object referred to by the argument/parameter, which is slightly different.)

    As for how it works – it’s important to understand the difference between a variable, a reference and an object.

    This method call:

    sort(arr);
    

    copies the value of the arr variable as the value of the parameter within the sort method. That value is a reference to an object (the array in this case). The method doesn’t change the value of arr at all – it’s still a reference to the same array. However, the method changes the contents of the array (i.e. which elements have which values).

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

Sidebar

Related Questions

Please suggest some good resources to start writing Java Web services.
Please read the whole question. I'm not looking for an approach to managing multi-lingual
Please order the function belows by growth rate from fastest to slowest: n^10 2^n
Please explain to me joins in simple language. Please do not post a web
Please consider my codes below: I'm getting an error Constructor on type 'System.String' not
Please forgive the newb question, but I am not finding answers elsewhere... probably because
(please excuse that I didn't use aliases). I would like my query output to
Please shed some light on me. How real-time system defines that events happened simultaneously?
Please note that this question is intended to be a bit more on the
Please recommend a C++ compression (zip) library for a commercial, closed-source application. So, not

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.