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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:34:14+00:00 2026-05-26T02:34:14+00:00

I saw in many libraries, when returning some result, is used return a =

  • 0

I saw in many libraries, when returning some result, is used return a = new A() (e.g. return entrySet = new EntrySet()) instead of returning just new EntrySet(), what’s the difference ?

  • 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-26T02:34:14+00:00Added an answer on May 26, 2026 at 2:34 am

    return a = new A() returns the value of the assignment of new A() to a. The value of an assignment is the value that was assigned.

    So they both return the exact same value.

    However return a = new A() also assigns the value to a. If a is a local variable, then this is an assignment that won’t have any effect and should be removed. If a is a field, then this might be used to remember the last returned value for some reason.

    In the latter case it will work, but I’d say that it’s bad style (that line does more than 1 thing. Actually it does 3 things) and I’d rewrite it like this:

    a = new A();
    return a;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to HTTP caching and really need some help... I saw many people
I saw in many application like Zara, Zara Home, D&G.. that instead of using
I saw many question addressing this issue but still i have some doubts... I
I saw many questions asking 'how' to unit test in a specific language, but
Fastest way to uniqify a list in Python without preserving order? I saw many
Many times I saw logging of errors like these: System.out.println(Method aMethod with parameters a:+a+
I saw some code like the following in a JSP <c:if test=<%=request.isUserInRole(RoleEnum.USER.getCode())%>> <li>user</li> </c:if>
When I saw many sites' source code, parameters were passed to the linking file
am new to this java world.. i just wanted to know how to convert
I saw many e-commerce sites using Pricegrabber for price comparison. For example: http://www.cheapstingybargains.com/184212/lg-gp08lu10-8x-dvd%C2%B1rw-dl-usb-20-slim-external-drive-w-lightscribe/ Is

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.