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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:18:12+00:00 2026-05-20T08:18:12+00:00

The this keyword is optional when accessing instance fields, properties, and methods in languages

  • 0

The this keyword is optional when accessing instance fields, properties, and methods in languages like C# and Java.

I’ve been doing some best practice research on various languages lately, and have noticed many places recommend creating a local reference to instance fields within methods because it’s more efficient. The latest mention was in an Android tutorial.

It seems to me that if you specify this._obj, it should be just as efficient as a local variable. Is this correct or is it just as ‘costly’ as not using this?

Does the answer change from the Android Dalvik VM, to standard Java, to C#?

public class test {
    private Object[] _obj;

    protected void myMethod() {
        Object[] obj = _obj;

        // Is there an appreciable differnce between
        for(int i = 0; i < obj.length; i++) { 
            // do stuff
        }

        // and this?
        for(int i = 0; i < this._obj.length; i++) { 
            // do stuff
        }
    }
}
  • 1 1 Answer
  • 2 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-20T08:18:13+00:00Added an answer on May 20, 2026 at 8:18 am

    No, there is absolutely no change in efficiency. Remember that in many languages, several equivalent expressions will reduce down to identical statements in the underlying bytecode or assembly or whatever the higher level language translates into.

    The answer is uniform across the languages and VMs you mention.

    Use it when necessary, like when a method parameter has the same name as an instance variable.

    Unless CPU cycles (or memory, etc.) are a top priority, value clarity above less expressive but more efficient language syntax.

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

Sidebar

Related Questions

What is the best practise for using the this keyword in Java? For example,
I'd like to add a keyword to my language. This keyword would only have
I want to do something like this, but the this keyword doesn't seem to
When you have an object instance in C#, you can use the this keyword
I've been reading through quite a few articles on the 'this' keyword when using
I know the function of this keyword, but I would like to know how
Is there any way to use this keyword inside a static method in Java?
I want to use the this keyword or something like typeof(this) in the where
In Intel Cilk Plus extension there's this keyword cilk_for (or _Cilk_for actually). It's like
I'd like to give a keyword, find the line where this keyword aṕpears in

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.