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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:28:07+00:00 2026-06-17T07:28:07+00:00

In netbeans I use to call a method that returns a value, but I

  • 0

In netbeans I use to call a method that returns a value, but I am directly calling it where I have to pass a parameter to the function i.e. Function(getValue()) where getValuue() returns String. So what I want to know is that what is more efficient way to call this method whether should I assign value to a string first and then pass that value to parameter, as netbeans suggests me and shows a warning there, or calling it directly is good? I know code runs fine but keeping in mind the efficiency or rules of coding should I consider this thing or not? Or how badly can it effect if I ignore it?

  • 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-17T07:28:08+00:00Added an answer on June 17, 2026 at 7:28 am

    If you are only using that value once, then calling it directly where it is used as a parameter is fine.

    In Java, this is fine:

    MyClass myClass = new MyClass();
    myFunction(myClass.getSomeValue());
    

    Whereas in the following case:

    MyClass myClass = new MyClass();
    MyOtherClass myOtherClass = myClass.someLongComputation();
    Int value = myFunction(myOtherClass);
    anotherFunction(value, myOtherClass);
    

    It may be better to have a local variable so that you avoid calling a long running calculation twice. However, for simple getValue()s, it really doesn’t matter.

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

Sidebar

Related Questions

I use Netbeans auto format (ctrl+alt+f) a lot. It's a very nice function!. But
I mostly use Eclipse but have mentionned Netbeans on my cv. Are there any
I want to use the jetty httpclient (in netbeans) but have the least number
I use Netbeans for development and have been doing my Mercurial operations on the
Question simple and quick: I have started to use Netbeans to write some code
I wanted to use JET (Java Emitter Templates) in my Netbeans projects, but had
For example I use Netbeans for PHP and have started to integrate PHPUnit &
I have written a class that extends JPanel. Is it possible to use this
I have decided to use Netbeans and Mercurial for my latest project (after no
I use netbeans 6.9 I want to use org.codehaus.staxmate.dom package but in does 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.